From 21bf5dcb1d7ea3183417df8a06f9574c94f5bab2 Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 3 Apr 2019 13:44:31 +0000 Subject: [PATCH] ide: Annotations now work even if code reference is in table, Draw: docs git-svn-id: svn://ultimatepp.org/upp/trunk@12938 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Draw/src.tpp/Colors_en-us.tpp | 20 ++++++++++++++++---- uppsrc/Draw/src.tpp/Rasters_en-us.tpp | 4 ++-- uppsrc/ide/Annotations.cpp | 20 ++++++++++++++++++-- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/uppsrc/Draw/src.tpp/Colors_en-us.tpp b/uppsrc/Draw/src.tpp/Colors_en-us.tpp index bceb7ef86..ccc5794af 100644 --- a/uppsrc/Draw/src.tpp/Colors_en-us.tpp +++ b/uppsrc/Draw/src.tpp/Colors_en-us.tpp @@ -15,11 +15,15 @@ topic ""; [s0; U`+`+ provides a set of colors that are adjusted according to current settings of host platform. Using these colors makes it easier to adapt the application to host platform settings.&] +[s0; &] +[s0; Following table shows colors that represent certain hue. When +transformed to dark theme, hue is maintained while brightness +of color changes.&] [s0;3%- &] [ {{3044:3508:1778:1670@7 [s0;%- Color] :: [s0;%- Description] -:: [s0;=%- Win 10 light] -:: [s0;=%- Win 10 dark] +:: [s0;=%- Light theme] +:: [s0;=%- Dark theme] ::@2 [s0;:SBlack`(`):%- Color [* SBlack]()] :: [s0;%- Possibly theme adjusted color.] :: [s0;=%- @@ -199,8 +203,16 @@ easier to adapt the application to host platform settings.&] :: [s0;=%- @@rawimage:256&96 (iVBORw0KGgoAAAANSUhEUgAAAIAAAAAwCAYAAADZ9HK+AAAACXBIWXMAAAAAAAAAAAHqZRakAAAApElEQVR4nO3coRGAQAwAwcDQIzVSJWgGz4vbdXkVcRP528zcQ9a+egHWEkCcAOKOz8t1LViD35zna3QB4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiBNAnADiBBAngDgBxAkgTgBxAogTQJwA4gQQJ4A4AcQJIE4AcQKIE0CcAOIEECeAOAHECSBOAHECiNvGX8FpLkCcAOIEEPcA038EXwIEgSEAAAAASUVORK5CYII=) -] -:: [s0;:SColorPaper`(`):%- Color [* SColorPaper]()] +]}}&] +[s0; &] +[s0; Following colors provide host platform provided information +about colors of GUI element parts:&] +[s0;%- &] +[ {{3044:3508:1778:1670@7 [s0;%- Color] +:: [s0;%- Description] +:: [s0;=%- Win 10 light] +:: [s0;=%- Win 10 dark] +::@2 [s0;:SColorPaper`(`):%- Color [* SColorPaper]()] :: [s0;%- Normal background.] :: [s0;=%- @@rawimage:256&96 diff --git a/uppsrc/Draw/src.tpp/Rasters_en-us.tpp b/uppsrc/Draw/src.tpp/Rasters_en-us.tpp index 2b0d827ba..1f328f987 100644 --- a/uppsrc/Draw/src.tpp/Rasters_en-us.tpp +++ b/uppsrc/Draw/src.tpp/Rasters_en-us.tpp @@ -1,5 +1,4 @@ topic "Common Raster classes"; -[2 $$0,0#00000000000000000000000000000000:Default] [i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] [l288;2 $$2,2#27521748481378242620020725143825:desc] [0 $$3,0#96390100711032703541132217272105:end] @@ -9,6 +8,7 @@ topic "Common Raster classes"; [l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] [i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] [b42;2 $$9,9#13035079074754324216151401829390:normal] +[2 $$0,0#00000000000000000000000000000000:Default] [{_} [ {{10000@(113.42.0) [s0;%% [*@7;4 ImageRaster]]}}&] [s3; &] @@ -151,4 +151,4 @@ progress of operation or to cancel it by returning true.&] [s2;%% Puts StreamRaster into error state (error state is reset by Open).&] [s3; &] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file diff --git a/uppsrc/ide/Annotations.cpp b/uppsrc/ide/Annotations.cpp index 89c7221f5..10d2b033c 100644 --- a/uppsrc/ide/Annotations.cpp +++ b/uppsrc/ide/Annotations.cpp @@ -23,7 +23,7 @@ void AssistEditor::Annotate(const String& filename) } } -bool IsCodeItem(RichText& txt, int i) +bool IsCodeItem(const RichTxt& txt, int i) { static Uuid codeitem = CodeItemUuid(); static Uuid stritem = StructItemUuid(); @@ -93,11 +93,26 @@ void AssistEditor::SyncAnnotationPopup() String path = GetTopicPath(tl); if(path != last_path) topic_text = ParseQTF(ReadTopic(LoadFile(path)).text); - RichText result; String cr = coderef; for(int pass = 0; pass < 2; pass++) { for(int i = 0; i < topic_text.GetPartCount(); i++) + if(topic_text.IsTable(i)) { + const RichTable& t = topic_text.GetTable(i); + Size sz = t.GetSize(); + for(int y = 0; y < sz.cy; y++) + for(int x = 0; x < sz.cx; x++) { + const RichTxt& txt = t.Get(y, x); + for(int i = 0; i < txt.GetPartCount(); i++) { + if(txt.IsPara(i) && txt.Get(i, topic_text.GetStyles()).format.label == cr) { + RichTable r(t, 1); + result.CatPick(pick(r)); + goto done; + } + } + } + } + else if(IsCodeItem(topic_text, i) && topic_text.Get(i).format.label == cr) { while(i > 0 && IsCodeItem(topic_text, i)) i--; if(!IsCodeItem(topic_text, i)) i++; @@ -118,6 +133,7 @@ void AssistEditor::SyncAnnotationPopup() if(pass == 0 && !LegacyRef(cr)) break; } + done: result.SetStyles(topic_text.GetStyles()); annotation_popup.Pick(pick(result), GetRichTextStdScreenZoom()); }