From: <ct...@us...> - 2011-02-26 07:03:23
|
Revision: 1659 http://colorer.svn.sourceforge.net/colorer/?rev=1659&view=rev Author: ctapmex Date: 2011-02-26 07:03:16 +0000 (Sat, 26 Feb 2011) Log Message: ----------- fix menu Modified Paths: -------------- trunk/far3colorer/changelog trunk/far3colorer/src/FarEditorSet.cpp trunk/far3colorer/src/pcolorer.cpp trunk/far3colorer/src/pcolorer.def trunk/far3colorer/src/pcolorer.h Modified: trunk/far3colorer/changelog =================================================================== --- trunk/far3colorer/changelog 2011-02-26 06:05:28 UTC (rev 1658) +++ trunk/far3colorer/changelog 2011-02-26 07:03:16 UTC (rev 1659) @@ -1,5 +1,10 @@ $Revision$ $Author$ $Date$ + 1. починка меню плагина и меню выбора типа файла + 2. переименование экспортируемых функций + +#Revision: 1658 + Author: ctapmex Date: 2011-02-26 11:05:28 +0500 (Сб, 26 фев 2011) 1. обновлен far3sdk 2. продолжаем адаптацию к новому API - читаем настройки и сохраняем через far api (пока кроме hrc настроек) Modified: trunk/far3colorer/src/FarEditorSet.cpp =================================================================== --- trunk/far3colorer/src/FarEditorSet.cpp 2011-02-26 06:05:28 UTC (rev 1658) +++ trunk/far3colorer/src/FarEditorSet.cpp 2011-02-26 07:03:16 UTC (rev 1659) @@ -1,12 +1,5 @@ #include"FarEditorSet.h" -int _snwprintf_s (wchar_t *string, size_t sizeInWords, size_t count, const wchar_t *format, ...) -{ - va_list arglist; - va_start(arglist, format); - return _vsnwprintf(string, count, format, arglist); -} - DWORD FarEditorSet::rGetValueDw(size_t Root, const wchar_t *name, DWORD DefaultValue) { FarSettingsItem fsi; @@ -112,114 +105,113 @@ void FarEditorSet::openMenu() { - //v3// - //int iMenuItems[] = - //{ - // mListTypes, mMatchPair, mSelectBlock, mSelectPair, - // mListFunctions, mFindErrors, mSelectRegion, mLocateFunction, -1, - // mUpdateHighlight, mReloadBase, mConfigure - //}; - //FarMenuItem menuElements[sizeof(iMenuItems) / sizeof(iMenuItems[0])]; - //memset(menuElements, 0, sizeof(menuElements)); + int iMenuItems[] = + { + mListTypes, mMatchPair, mSelectBlock, mSelectPair, + mListFunctions, mFindErrors, mSelectRegion, mLocateFunction, -1, + mUpdateHighlight, mReloadBase, mConfigure + }; + FarMenuItem menuElements[sizeof(iMenuItems) / sizeof(iMenuItems[0])]; + memset(menuElements, 0, sizeof(menuElements)); - //try{ - // if (!rEnabled){ - // menuElements[0].Text = GetMsg(mConfigure); - // menuElements[0].Selected = 1; + try{ + if (!rEnabled){ + menuElements[0].Text = GetMsg(mConfigure); + menuElements[0].Flags = MIF_SELECTED; - // if (Info.Menu(Info.ModuleNumber, -1, -1, 0, FMENU_WRAPMODE, GetMsg(mName), 0, L"menu", NULL, NULL, menuElements, 1) == 0){ - // ReadSettings(); - // configure(true); - // } + if (Info.Menu(&MainGuid, -1, -1, 0, FMENU_WRAPMODE, GetMsg(mName), 0, L"menu", NULL, NULL, menuElements, 1) == 0){ + ReadSettings(); + configure(true); + } - // return; - // }; + return; + }; - // for (int i = sizeof(iMenuItems) / sizeof(iMenuItems[0]) - 1; i >= 0; i--){ - // if (iMenuItems[i] == -1){ - // menuElements[i].Separator = 1; - // } - // else{ - // menuElements[i].Text = GetMsg(iMenuItems[i]); - // } - // }; + for (int i = sizeof(iMenuItems) / sizeof(iMenuItems[0]) - 1; i >= 0; i--){ + if (iMenuItems[i] == -1){ + menuElements[i].Flags = MIF_SEPARATOR;; + } + else{ + menuElements[i].Text = GetMsg(iMenuItems[i]); + } + }; - // menuElements[0].Selected = 1; + menuElements[0].Flags = MIF_SELECTED; - // // \xF2.\xEA. \xF2\xE5\xEE\xF0\xE8\xF2\xE8\xF7\xE5\xF1\xEA\xE8 \xF4\xF3\xED\xEA\xF6\xE8\xFF getCurrentEditor \xEC\xEE\xE6\xE5\xF2 \xE2\xE5\xF0\xED\xF3\xF2\xFC NULL, \xF2\xEE \xE1\xF3\xE4\xE5\xEC - // // \xEF\xF0\xEE\xE2\xE5\xF0\xFF\xF2\xFC \xED\xE0 \xFD\xF2\xEE. \xCD\xEE \xF1\xE8\xF2\xF3\xE0\xF6\xE8\xFF \xE2\xEE\xE7\xE2\xF0\xE0\xF2\xE0 NULL \xED\xE5 \xED\xEE\xF0\xEC\xE0\xEB\xFC\xED\xE0, \xEE\xF8\xE8\xE1\xEA\xE0 \xE3\xE4\xE5 \xF2\xEE \xE2 \xE4\xF0\xF3\xE3\xEE\xEC \xEC\xE5\xF1\xF2\xE5 - // FarEditor *editor = getCurrentEditor(); - // switch (Info.Menu(Info.ModuleNumber, -1, -1, 0, FMENU_WRAPMODE, GetMsg(mName), 0, L"menu", NULL, NULL, - // menuElements, sizeof(iMenuItems) / sizeof(iMenuItems[0]))) - // { - // case 0: - // if (editor){ - // chooseType(); - // } - // break; - // case 1: - // if (editor){ - // editor->matchPair(); - // } - // break; - // case 2: - // if (editor){ - // editor->selectBlock(); - // } - // break; - // case 3: - // if (editor){ - // editor->selectPair(); - // } - // break; - // case 4: - // if (editor){ - // editor->listFunctions(); - // } - // break; - // case 5: - // if (editor){ - // editor->listErrors(); - // } - // break; - // case 6: - // if (editor){ - // editor->selectRegion(); - // } - // break; - // case 7: - // if (editor){ - // editor->locateFunction(); - // } - // break; - // case 9: - // if (editor){ - // editor->updateHighlighting(); - // } - // break; - // case 10: - // ReloadBase(); - // break; - // case 11: - // configure(true); - // break; - // }; - //} - //catch (Exception &e){ - // const wchar_t* exceptionMessage[5]; - // exceptionMessage[0] = GetMsg(mName); - // exceptionMessage[1] = GetMsg(mCantLoad); - // exceptionMessage[3] = GetMsg(mDie); - // StringBuffer msg("openMenu: "); - // exceptionMessage[2] = (msg+e.getMessage()).getWChars(); + // \xF2.\xEA. \xF2\xE5\xEE\xF0\xE8\xF2\xE8\xF7\xE5\xF1\xEA\xE8 \xF4\xF3\xED\xEA\xF6\xE8\xFF getCurrentEditor \xEC\xEE\xE6\xE5\xF2 \xE2\xE5\xF0\xED\xF3\xF2\xFC NULL, \xF2\xEE \xE1\xF3\xE4\xE5\xEC + // \xEF\xF0\xEE\xE2\xE5\xF0\xFF\xF2\xFC \xED\xE0 \xFD\xF2\xEE. \xCD\xEE \xF1\xE8\xF2\xF3\xE0\xF6\xE8\xFF \xE2\xEE\xE7\xE2\xF0\xE0\xF2\xE0 NULL \xED\xE5 \xED\xEE\xF0\xEC\xE0\xEB\xFC\xED\xE0, \xEE\xF8\xE8\xE1\xEA\xE0 \xE3\xE4\xE5 \xF2\xEE \xE2 \xE4\xF0\xF3\xE3\xEE\xEC \xEC\xE5\xF1\xF2\xE5 + FarEditor *editor = getCurrentEditor(); + switch (Info.Menu(&MainGuid, -1, -1, 0, FMENU_WRAPMODE, GetMsg(mName), 0, L"menu", NULL, NULL, + menuElements, sizeof(iMenuItems) / sizeof(iMenuItems[0]))) + { + case 0: + if (editor){ + chooseType(); + } + break; + case 1: + if (editor){ + editor->matchPair(); + } + break; + case 2: + if (editor){ + editor->selectBlock(); + } + break; + case 3: + if (editor){ + editor->selectPair(); + } + break; + case 4: + if (editor){ + editor->listFunctions(); + } + break; + case 5: + if (editor){ + editor->listErrors(); + } + break; + case 6: + if (editor){ + editor->selectRegion(); + } + break; + case 7: + if (editor){ + editor->locateFunction(); + } + break; + case 9: + if (editor){ + editor->updateHighlighting(); + } + break; + case 10: + ReloadBase(); + break; + case 11: + configure(true); + break; + }; + } + catch (Exception &e){ + const wchar_t* exceptionMessage[5]; + exceptionMessage[0] = GetMsg(mName); + exceptionMessage[1] = GetMsg(mCantLoad); + exceptionMessage[3] = GetMsg(mDie); + StringBuffer msg("openMenu: "); + exceptionMessage[2] = (msg+e.getMessage()).getWChars(); - // if (getErrorHandler()){ - // getErrorHandler()->error(*e.getMessage()); - // } + if (getErrorHandler()){ + getErrorHandler()->error(*e.getMessage()); + } - // Info.Message(Info.ModuleNumber, FMSG_WARNING, L"exception", &exceptionMessage[0], 4, 1); - // disableColorer(); - //}; + Info.Message(&MainGuid, FMSG_WARNING, L"exception", &exceptionMessage[0], 4, 1); + disableColorer(); + }; } @@ -317,8 +309,8 @@ } void FarEditorSet::chooseType() -{//v3// - /* FarEditor *fe = getCurrentEditor(); +{ + FarEditor *fe = getCurrentEditor(); if (!fe){ return; } @@ -340,7 +332,7 @@ } if (group != NULL && !group->equals(type->getGroup())){ - menuels[i].Separator = 1; + menuels[i].Flags = MIF_SEPARATOR; i++; }; @@ -359,14 +351,14 @@ _snwprintf((wchar_t*)menuels[i].Text, 255, L"%c. %s: %s", idx < 36?MapThis[idx]:'x', groupChars, type->getDescription()->getWChars()); if (type == fe->getFileType()){ - menuels[i].Selected = 1; + menuels[i].Flags = MIF_SELECTED; } }; wchar_t bottom[20]; int i; _snwprintf(bottom, 20, GetMsg(mTotalTypes), hrcParser->getFileTypesCount()); - i = Info.Menu(Info.ModuleNumber, -1, -1, 0, FMENU_WRAPMODE | FMENU_AUTOHIGHLIGHT, + i = Info.Menu(&MainGuid, -1, -1, 0, FMENU_WRAPMODE | FMENU_AUTOHIGHLIGHT, GetMsg(mSelectSyntax), bottom, L"contents", NULL, NULL, menuels, num); for (int idx = 0; idx < num; idx++){ @@ -384,7 +376,7 @@ type = getFileTypeByIndex(i); if (type != NULL){ fe->setFileType(type); - }*/ + } } const String *FarEditorSet::getHRDescription(const String &name, DString _hrdClass ) @@ -799,8 +791,8 @@ LoadUserHrd(userHrdPathS, parserFactoryLocal); LoadUserHrc(userHrcPathS, parserFactoryLocal); FarHrcSettings p(parserFactoryLocal); - p.readProfile(); - p.readUserProfile(); + // p.readProfile(); + //p.readUserProfile(); try{ regionMapperLocal = parserFactoryLocal->createStyledMapper(&DConsole, sTempHrdName); @@ -916,8 +908,8 @@ LoadUserHrd(sUserHrdPathExp, parserFactory); LoadUserHrc(sUserHrcPathExp, parserFactory); FarHrcSettings p(parserFactory); - p.readProfile(); - p.readUserProfile(); + //p.readProfile(); + // p.readUserProfile(); defaultType= (FileTypeImpl*)hrcParser->getFileType(&DString("default")); try{ Modified: trunk/far3colorer/src/pcolorer.cpp =================================================================== --- trunk/far3colorer/src/pcolorer.cpp 2011-02-26 06:05:28 UTC (rev 1658) +++ trunk/far3colorer/src/pcolorer.cpp 2011-02-26 07:03:16 UTC (rev 1659) @@ -96,7 +96,7 @@ /** Open plugin configuration of actions dialog. */ -HANDLE WINAPI OpenPluginW(int OpenFrom, INT_PTR Item) +HANDLE WINAPI OpenPanelW(OPENPANEL_OPENFROM OpenFrom, const GUID* Guid, INT_PTR Data) { if (OpenFrom == OPEN_EDITOR){ editorSet->openMenu(); @@ -104,7 +104,7 @@ else if (OpenFrom == OPEN_COMMANDLINE){ //file name, which we received - wchar_t *file = (wchar_t*)Item; + wchar_t *file = (wchar_t*)Data; wchar_t *nfile = PathToFull(file,true); if (nfile){ Modified: trunk/far3colorer/src/pcolorer.def =================================================================== --- trunk/far3colorer/src/pcolorer.def 2011-02-26 06:05:28 UTC (rev 1658) +++ trunk/far3colorer/src/pcolorer.def 2011-02-26 07:03:16 UTC (rev 1659) @@ -1,7 +1,7 @@ LIBRARY EXPORTS GetGlobalInfoW - OpenPluginW + OpenPanelW SetStartupInfoW GetPluginInfoW ConfigureW Modified: trunk/far3colorer/src/pcolorer.h =================================================================== --- trunk/far3colorer/src/pcolorer.h 2011-02-26 06:05:28 UTC (rev 1658) +++ trunk/far3colorer/src/pcolorer.h 2011-02-26 07:03:16 UTC (rev 1659) @@ -1,16 +1,6 @@ #ifndef _PCOLORER_H_ #define _PCOLORER_H_ -/** - Visual Leak Detector http://sites.google.com/site/dmoulding/vld . - Optional -*/ -#ifdef _DEBUG -#ifndef _WIN64 -//#include<vld.h> -#endif -#endif - #include<plugin.hpp> #include<farcolor.hpp> #include<farkeys.hpp> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |