|
Модераторы: Vitalik |
|
DavidCl0nel |
|
||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
The Paint Problem with IndentGuides:
This is no fixed Code, only with my comments (<-->), that you see the problem:
Solution would be, that you make the decision Red or not Red after your bold line. And the fix for missing Update of foldranges, if keywords are case-sensitive:
Thats all. Now i try to search the Copy/Cut-Problem. |
||||
|
|||||
Sep. |
|
||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Now i understand about what you say. =) I think that mod named "IndentGiudes change highlight" can change color too. =) Of course there can be backup of color done. But i use Black, if you need Red, you can change this in mod. If mod not instaleed then all by default. If there made backup of color, then mod need to rename to "IndentGiudes change highlight style" =) You think it's important? Then i will do it.
will add to next SynMix release --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||
|
|||||
DavidCl0nel |
|
||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Write your mod like this:
Canvas.Pen.Color := clGray || clRed; // if... OldColor := Canvas.Pen.Color; Canvas.Pen.Color := clGray; // mod.. Canvas.MoveTo(X, Y); // Canvas.LineTo(X, rcLine.Bottom); // Canvas.Pen.Color := OldColor; // ...//draw guides Then it should be what you want - a gray line behind the indent guide line. I dont use the mod anyway. But you should do this in SynMix. Copy-Problem:
Now he copy the foldrange, if you select until the last character of fold line (only then). And also CutToClipboard copies the right text in clipboard, but dont delete fold range. I will fix this now. Edit: One problem is, that Cut dont call CanExecuteInLine, so you can cut a hald line of collapsed fold range... PS: I have problems with login in forum now. (logout every post) Is this my cookie-problem or is it a failure with the forum? Edit: Cut-Problem solved with:
He called the function, but didnt do something, because Count was 0 (sure if you select only from beginning to end of line). Now he deletes the fold correctly. Remaining thing is that you are allowed to Cut something in a collapsed line. Delete is forbidden there, but cut works... Mmh. Fix:
But the call of CanExecute is maybe not really good there, if you call Cut on another way. But I have no idea where. Sure I can forbid it in SetSelTextExternal, but then the text was already copied, so i only forbid the half thing. PS: I had again login into forum, what is the problem. Это сообщение отредактировал(а) DavidCl0nel - 4.9.2006, 11:17 |
||||||
|
|||||||
Sep. |
|
||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
I can't reuse OldColor because it already holds color. I rewrite with other variable.
One more bug fixed =) When i press hotkey, it converts it to ComandProcessor word and then there is case:
So it run CopyToClipboard from everywhere. This all ok, i miss it. But there some bug in your new code that you mail me: =( When i select string from start to end and press Ctrl-C then i have drop of current foldrange. It copyes to buffer ok, and i can press Ctrl-Z to return it back. Ctrl-X works ok in that case. I can send compiled version to you. Again Delphi5 case? OFF:
What browser do you use? I have problems with post messages under Opera9, it have no button 'Send' for me. Under IE all ok. There many users have this bug, it posted in support topic on this forum. But i cant see topic about login problems. May be some cookie problem, untrusted site e.t.c. --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||
|
|||||||||
DavidCl0nel |
|
||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Good, now I changed the Case as like the other:
Maybe he called CanExecuteInLine now 2 times, here and after that in CutToClipboard, but there are the two ways to get there - i cant remove one i think. The same here:
I dont know, when this is called with Windows-message, but it had to check this CanExecuteInLine first, that I can only cut a foldrange if I select it from begin to end of line, not half text. For safety. ;) >>When i select string from start to end and press Ctrl-C then i have drop of current foldrange. It copyes to buffer ok, and i can press Ctrl-Z to return it back. It works perfectly here. I dont know what the problem is... Can you debug the case, where he update the foldrange? Breakpoints on LinesDeleted(), UpdateFoldRanges(), etc... He shouldn't call this functions, if it isn't needed... Is this the last bug or do you have something else I dont have. I dont know, if you have solved the other ore if they disappear silently with other updates? >>What browser do you use? Maxthon, but it is only a kind of browser enhancement (tabbing and such things), the main (parsing, drawing...) is IE6 in there. He 2 times delete or dont accept my login-cookie (only on this site here!) and i lost 2 posts with a error-message (russian, i cant read - but i think it was "you had to logon first, you idiot"). Back and my post text was away, but i have saved it in clipboard. Now, one day after last login, i am already logged in, so the problem is away. Edit: Found a new Bug If you delete a line with Ctrl+Y (Standard Keystroke), he don't update foldranges and Undobuffer.... Grmpf. EditEdit: Not exactly, Ctrl+Y was assigned in my MainMenu that called SynMemo.Lines.Delete(...). If I use the Ctrl+Y from Keystroke he delete also correctly, updates the Undobuffer but move only the foldrange (i have destroyed it really with my delete). But i will look at it now. EditEditEdit:
Now it updates all ok. A little thing left: I have in my Editor MainMenu an Undo, that you can click it there or see the ShortCut for Undo. If I call Undo on this way he dont restore the foldrange, if I delete the line with keyword like above. If I dont assign the ShortCut in MainMenu, the pressed shortcut goes to SynMemo directly and then he restore the foldrange. There I had to think about it. An user of the Editor should see the ShortCuts he dont know and had to call the function by clicking in the Menu.... Hmm. Это сообщение отредактировал(а) DavidCl0nel - 5.9.2006, 12:13 |
||||||
|
|||||||
Sep. |
|
||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Why do you think so? Case executing CutToClipboard and there you check CanExecuteInLine. No need to change ecCut case and WMCut. You allway go to CutToClipboard. There is already two checks for ReadOnly.
Checked, it don't run this functions. Drop is somewhere else, i'll try to get D7 and check under it. Can you say what difference beetwen D5 and BDS2006? So i know what to check first.
you need to make assigns to SynEdit.Keystrokes, and read them as hotkeys in menu. I already do this in my prog, and make patch when Key:=0. =)
ok --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||
|
|||||||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
>>You allway go to CutToClipboard
Ok, then I will remove the extra check. >>Can you say what difference beetwen D5 and BDS2006? Delphi5 is very old, i know - but it is an stable release. I dont work with BD2006 very good (i test it short - i dont find the things like i want. Placing components, where are the windows etc ;) Its difficult to go to the new gui). With Delphi7 Borland decided to make Pascal more innocent from operating system - so the whole Q-thing (QSynEdit.pas and all common delphi functions in QForm, Q..) for Kylix is new under Delphi7. Also the quite common internet-controls from Indy was first built in Delphi7 I think. And many little things are different (do you remember my TList.Assign? Delphi5 hasnt it... and i think there are a lot of more such things). So it isnt very simple to say that. ;) I dont know what is the matter with your folddrops that i dont have... >>you need to make assigns to SynEdit.Keystrokes, and read them as hotkeys in menu. I already do this in my prog, and make patch when Key:=0 Ctrl+Y is the default keystroke for Delete-Line, if i dont assign my shortcut to mainmenu he automatically call it in syn and it works. But i want to show the shortcut and give the possibility to call the function via mainmenu so i had to set a shortcut there. Or how is it possible to call the keystroke-function in my mainmenu.onclick-procedure? |
|||
|
||||
Sep. |
|
||||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
See code for TCustomSynEdit.TranslateKeyCode that executes from TCustomSynEdit.KeyDown. It converts key to CommandProcessor word. So you have two ways: 1. call KeyDown with hotkey for this command: KeyDown(ord('Z'), [ssCtrl]); for example for undo 2. direct call needed command for this menu item : synedit.CommandProcessor(ecUndo, #0, nil); Left bugs in synMix: 1. Wrong gutter calculation when gutter font differs from text font (CharWidth var) 2. Wrong gutter width calculation when gutter.AutoSize enabled and you fold some text. (End line has number >100 but gutter has width for 2 digits only) 3. Codefolding ranges searched in comments and "strings". Need to make workaround like in MatchBracket, but it'll work only for SynUniHL. I tryed, but can't =( Added: Ok bug 2 fixed: SynEditMiscClasses.pas
SynEdit.pas
--------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||||
|
|||||||||||
Sep. |
|
|||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Now i fixed bug 1 ! =)
But there too many small changes in code to post on forum. I'll release it next SynMix, or can mail to you if you wish to test. Now only one left. =) --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
|||
|
||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
>>direct call needed command for this menu item : synedit.CommandProcessor(ecUndo, #0, nil);
Thats a good idea. Now I use it that way. First possibility is bad, because you need an extra assignment for your shortcut. (If you change it, ...) >>Left bugs in synMix: >>1. Wrong gutter calculation when gutter font differs from text font (CharWidth var) >>2. Wrong gutter width calculation when gutter.AutoSize enabled and you fold some text. (End line has number >100 but gutter has width for 2 digits only) >>3. Codefolding ranges searched in comments and "strings". Need to make workaround like in MatchBracket, but it'll work only for SynUniHL. I tryed, but can't =( -> 1.) Ok, but i think a very low priority. My first tries to do that shows, that it isnt as simple as it looks like. -> 2.) Ok. -> 3.) Hmm yes, but so you had to know, what a String or a Comment is. So you had to work with your highlighter... But the type for "String" or "Comment" can be named like you want in Highlighter... It looks very difficult. 4. I found an other little thing, try to check, if you have the same. If you select the first line of a fold (with the keyword) and delete the line, the foldrange isnt remove. If you select 2 lines, it works. It looks like the problem, that he dont call LinesDeleted now. I search for it, if I have time for it. Edit: It had fixed, that he dont call UpdateFoldRanges with zero lines. This If consists the GutterChanged-Call, so he delete it correctly, but dont redraw the gutter, so the end-marker of fold range was visible. Complete function is now:
Now also the Variable for Undo position (they arent needed..) set to zero insted of put random numbers in this array. If you debug later, you aren't confused by that. Это сообщение отредактировал(а) DavidCl0nel - 7.9.2006, 12:11 |
|||
|
||||
Sep. |
|
|||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Mail from Guru Kathiresan:
ok, but i never see this exception --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
|||
|
||||
DavidCl0nel |
|
||||||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Normally this Code isnt executed.
I call this Function now with an extra button for an character at end of line. If I set the correct position, he copy it correctly, if i set the position to one behind, he crashs with exception. So he is right. Fix is the +1
I try 3. now, but i have a question. You have your keywords for foldranges in your Highlighter. Where and how you set it in your Highlighter-component? In constructor TSynYourHighlighterNameSyn.Create(AOwner: TComponent)? Or where? I set my foldranges in my program, not in the highlighter, but if it possible, i would move it in Highlighter. In the Highlighter you have the information about Strings and Comments, so it is more easy. There is a possibility to define SkipRegions for FoldRanges, maybe we should write something in there, that he dont look for skipregions in comments. Edit: After my keywords for CodeFolding i do that:
So now I can comment a keyword, but i had to force Update of CodeFolding (destroy another keyword, that he knows he must update). After this update he removed the commented foldregion. But with this I got an exception after closing the program in SynTextDrawe.pas: TheFontsInfoManager.ReleaseFontsInfo(). Dont know what and why. Some other little thing. I fall back to the old one:
Earlier P was changed, if KeyWordClose is in there. It was needed for Drawing the IndentGuides in the other color. This isnt work correctly, so i return it to the old behavior.
And the main change is in Paint-procedure.
Now it checks the lines, not the other Variable, that wasnt set correctly by IsKeywordAtCursorPos(). Now I can move the cursor through the text and got, if the cursor is between a open and a close keyword, the right color line. Это сообщение отредактировал(а) DavidCl0nel - 7.9.2006, 16:43 |
||||||||||
|
|||||||||||
Sep. |
|
||||||||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
I don't know, i simply use SynUniHL and it has support of CodeFoldingRanges. Vitalik is developer of component, he can say more. There is rule for naming styles in *.hgl files, Comment styles must start from 'comment' or 'remark' (For example 'Comment /*...*/') String styles must have names starting as 'string'. So i need do GetHighlighterAttriAtRowCol and check attri.Name. This is temporaly, we want to make normal string/comment check for styles. It need to some update SynUniHL for that. I make same workaround for bug3 as in MatchBracket. It works ok for rtChar, but very slow for rtKeyWord type foldranges. Now i comment code for rtKeyWord, only left rtChar (php, C, java : {}) Need to make needed changes in SynUniHL first...
Yes i try to use it, but there no support of it in SynUniHL. I can't use hadcoded skipregions now. Error is because of wrong memory free in TSkipRegionItem.Destroy() i think
Yes, i need to do it too, in my workaround. Need to think how to run auto-updating in this case.
ok
But there is already
Cool! But don't work fully as expected. It need to do many invalidateLines. When i move cursor inside foldrange, it paint highlighted indentguide only for line at cursor. If cursor near foldrange keyword - then it paints full current indentguide correctly, but if move cursor to other foldrange - it don't repaint old indentguide as non-highlighted =( --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||||||||
|
|||||||||||||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
>>I make same workaround
Show me, if it looks good. >>in couple of lines before Yes, but only for ecDeleteLine. But it isnt needed then, you are right. And if you move cursor you dont DeleteLine, but you had to repaint it, so i repaint it every time. Try it and say me, if your "But don't work fully as expected" still exists. ;) Hmm, it doesnt work for clicks correctly, maybe you mean this. If you move cursor with up/down/pageup/etc it repaint it every key and works good.
Это сообщение отредактировал(а) DavidCl0nel - 7.9.2006, 19:05 |
|||
|
||||
Sep. |
|
|||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
ok, time to some synchronize changes. SinMix update 7/09/06
I've some update 'mod highlight current IndentGuide' so it works with mouse clicks too. It will be great if it highlights only most deeper indentguide, when there are couple of foldranges one inside other. For 'mod CF-range in comments' you can use SkipRegions, I'll wait SynUniHL update. For write more faster mod. Need to think how auto-update foldregions when write comment. --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
|||
|
||||
Rules and hints for the forum "SynUniHighlighter" | |
|
Hello, dear user! This is official forum for SynUniHighlighter component and unofficial forum for SynEdit, Codefolding and all related projects. Some rules for the forum: 1. Do not create new topic if exactly the same already exists. 2. Don't ask several questions in the same topic. One topic - one question. 3. If discussion changes to far from original topic context, then create a separate thread for new discussion subject. If you already registered then click here to log in. If you havent't registered yet then click here and register. You need to type username, password (twice), email (twice) and security code. Next you need go here and choose English language instead of Russian and press Enter. Some hints for enghlish-speaking users: - create new topic; - create new vote; - answer to the topic. |
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей) | |
0 Пользователей: | |
« Предыдущая тема | SynUniHighlighter and SynEdit (English Language) | Следующая тема » |
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |