From: <ct...@us...> - 2011-07-04 06:00:52
|
Revision: 1729 http://colorer.svn.sourceforge.net/colorer/?rev=1729&view=rev Author: ctapmex Date: 2011-07-04 06:00:45 +0000 (Mon, 04 Jul 2011) Log Message: ----------- optimization Modified Paths: -------------- trunk/far3colorer/changelog trunk/far3colorer/src/ChooseTypeMenu.cpp trunk/far3colorer/src/ChooseTypeMenu.h trunk/far3colorer/src/FarEditor.cpp trunk/far3colorer/src/FarEditor.h trunk/far3colorer/src/FarEditorSet.cpp trunk/far3colorer/src/FarEditorSet.h Modified: trunk/far3colorer/changelog =================================================================== --- trunk/far3colorer/changelog 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/changelog 2011-07-04 06:00:45 UTC (rev 1729) @@ -1,5 +1,9 @@ $Revision$ $Author$ $Date$ + 1. некоторые оптимизации + +#Revision: 1728 + #Author: ctapmex Date: 2011-07-04 11:24:47 +0600 (Пн, 04 июл 2011) 1. дополнена справка #Revision: 1727 Modified: trunk/far3colorer/src/ChooseTypeMenu.cpp =================================================================== --- trunk/far3colorer/src/ChooseTypeMenu.cpp 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/ChooseTypeMenu.cpp 2011-07-04 06:00:45 UTC (rev 1729) @@ -72,16 +72,10 @@ int ChooseTypeMenu::AddItem(const FileType* fType, size_t PosAdd) { - const String *v; - v=((FileTypeImpl*)fType)->getParamValue(DHotkey); - StringBuffer s; - if (v!=NULL && v->length()){ - s.append(DString("&")).append(v); - }else{ - s.append(DString(" ")); - } - s.append(DString(" ")).append(((FileType*)fType)->getDescription()); - return AddItem(s.getWChars(), 0, fType, PosAdd); + StringBuffer *s=GenerateName(fType); + size_t k=AddItem(s->getWChars(), 0, fType, PosAdd); + delete s; + return k; } void ChooseTypeMenu::SetSelected(size_t index) @@ -176,15 +170,23 @@ if (Item[index].Text){ free((void*) Item[index].Text); } + + StringBuffer *s=GenerateName(GetFileType(index)); + Item[index].Text= _wcsdup(s->getWChars()); + delete s; +} + +StringBuffer* ChooseTypeMenu::GenerateName(const FileType* fType) +{ const String *v; - v=((FileTypeImpl*)GetFileType(index))->getParamValue(DHotkey); - StringBuffer s; + v=((FileTypeImpl*)fType)->getParamValue(DHotkey); + StringBuffer *s=new StringBuffer; if (v!=NULL && v->length()){ - s.append(DString("&")).append(v); + s->append(DString("&")).append(v); }else{ - s.append(DString(" ")); + s->append(DString(" ")); } - s.append(DString(" ")).append(((FileType*)GetFileType(index))->getDescription()); + s->append(DString(" ")).append(((FileType*)fType)->getDescription()); - Item[index].Text= _wcsdup(s.getWChars()); + return s; } \ No newline at end of file Modified: trunk/far3colorer/src/ChooseTypeMenu.h =================================================================== --- trunk/far3colorer/src/ChooseTypeMenu.h 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/ChooseTypeMenu.h 2011-07-04 06:00:45 UTC (rev 1729) @@ -27,6 +27,7 @@ void DelFromFavorites(size_t index); bool IsFavorite(size_t index); void RefreshItemCaption(size_t index); + StringBuffer* GenerateName(const FileType* fType); private: size_t ItemCount; Modified: trunk/far3colorer/src/FarEditor.cpp =================================================================== --- trunk/far3colorer/src/FarEditor.cpp 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/FarEditor.cpp 2011-07-04 06:00:45 UTC (rev 1729) @@ -466,7 +466,7 @@ baseEditor->validate(ei.TopScreenLine, true); } -int FarEditor::editorInput(const INPUT_RECORD Rec) +int FarEditor::editorInput(const INPUT_RECORD &Rec) { if (Rec.EventType == KEY_EVENT && Rec.Event.KeyEvent.wVirtualKeyCode == 0){ Modified: trunk/far3colorer/src/FarEditor.h =================================================================== --- trunk/far3colorer/src/FarEditor.h 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/FarEditor.h 2011-07-04 06:00:45 UTC (rev 1729) @@ -123,7 +123,7 @@ /** Handle passed FAR editor event */ int editorEvent(int event, void *param); /** Dispatch editor input event */ - int editorInput(const INPUT_RECORD Rec); + int editorInput(const INPUT_RECORD &Rec); void cleanEditor(); Modified: trunk/far3colorer/src/FarEditorSet.cpp =================================================================== --- trunk/far3colorer/src/FarEditorSet.cpp 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/FarEditorSet.cpp 2011-07-04 06:00:45 UTC (rev 1729) @@ -357,6 +357,7 @@ menu.GetFileType(i)->setParamValue(DHotkey,&DString(KeyAssignDlgData[2].Data)); menu.RefreshItemCaption(i); } + menu.SetSelected(i); } else { @@ -674,7 +675,7 @@ return parserFactory->enumerateHRDInstances(_hrdClass, result); } -int FarEditorSet::editorInput(const INPUT_RECORD Rec) +int FarEditorSet::editorInput(const INPUT_RECORD &Rec) { if (rEnabled){ FarEditor *editor = getCurrentEditor(); Modified: trunk/far3colorer/src/FarEditorSet.h =================================================================== --- trunk/far3colorer/src/FarEditorSet.h 2011-07-04 05:24:47 UTC (rev 1728) +++ trunk/far3colorer/src/FarEditorSet.h 2011-07-04 06:00:45 UTC (rev 1729) @@ -84,7 +84,7 @@ /** Dispatch editor event in the opened editor */ int editorEvent(int Event, void *Param); /** Dispatch editor input event in the opened editor */ - int editorInput(const INPUT_RECORD Rec); + int editorInput(const INPUT_RECORD &Rec); /** Get the description of HRD, or parameter name if description=null */ const String *getHRDescription(const String &name, DString _hrdClass); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |