1 /* 2 FXiTe - The Free eXtensIble Text Editor 3 Copyright (c) 2009-2012 Jeffrey Pohlmeyer <yetanothergeek@gmail.com> 4 5 This program is free software; you can redistribute it and/or modify it 6 under the terms of the GNU General Public License version 3 as 7 published by the Free Software Foundation. 8 9 This software is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 */ 18 19 20 21 22 typedef struct _MenuSpec { 23 FXint sel; 24 char pref[32]; 25 const char* mnu_txt; 26 const char* btn_txt; 27 char accel[32]; 28 char type; 29 union { 30 FXMenuCommand*ms_mc; 31 char *ms_fn; 32 }; 33 } MenuSpec; 34 35 36 37 #define TBAR_MAX_BTNS 24 38 #define POPUP_MAX_CMDS 24 39 40 class UsrMnuCmd; 41 class SciDoc; 42 43 44 class MenuMgr { 45 private: 46 friend class UsrMnuCmd; 47 static void ValidateUsrTBarCmd(FXMenuCommand*mc); 48 static void InvalidateUsrTBarCmd(FXMenuCommand*mc); 49 public: 50 static FXMenuCommand*MakeMenuCommand(FXComposite*p, FXObject*tgt, FXSelector sel, char type, bool checked=false); 51 static void ShowPopupMenu(FXPoint*pt); 52 static MenuSpec*MenuSpecs(); 53 static FXint*TBarBtns(); 54 static MenuSpec*LookupMenu(FXint sel); 55 static MenuSpec*LookupMenuByPref(const char*pref); 56 static const char*TBarColors(FXint i); 57 static const char*GetUsrCmdPath(MenuSpec*spec); 58 static void GetTBarBtnTip(MenuSpec*spec, FXString &tip); 59 static void GetTipFromFilename(const char*filename, FXString &tip); 60 static MenuSpec*AddTBarUsrCmd(FXMenuCommand*mc); 61 static void RemoveTBarUsrCmd(MenuSpec*spec); 62 static void PurgeTBarCmds(); 63 static void WriteToolbarButtons(FXRegistry*reg, const char*tbar_section); 64 static void ReadToolbarButtons(FXRegistry*reg, const char*tbar_section); 65 static void ReadMenuSpecs(FXRegistry*reg, const char* keys_sect); 66 static void WriteMenuSpecs(FXRegistry*reg, const char* keys_sect); 67 static void ReadPopupMenu(FXRegistry*reg, const char* popup_sect); 68 static void WritePopupMenu(FXRegistry*reg, const char* popup_sect); 69 static char**GetPopupCommands(); 70 static void FreePopupCommands(); 71 static void RadioUpdate(FXSelector curr, FXSelector min, FXSelector max); 72 static void UpdateEolMenu(SciDoc*sci); 73 static void SetFileFormat(SciDoc*sci, FXSelector sel); 74 static char SetTabOrientation(FXSelector sel); 75 }; 76 77