Menu Customization Example

English main discussion
Post Reply
  • Author
  • Message
Offline
Posts: 9
Joined: Sun Dec 05, 2010 10:09 pm

Menu Customization Example

Post by keith »

Hello All,

The plugin documentation mentions that you can rebuild the entire main menu but does not provide an example for doing this. I have decided to post my customized menu for anyone else that might be looking to do this too.

BTW - If anyone knows how to display the hotkeys associated to a menu function I would be interested. I can put the text there but it does not line up the way the user would expect. I also tried using the "\t" sequence but that did not work either.

Code: Select all

CLEAR
"&File" Index(0)
{
	"&New" Command(4101)
	"New &Window" Command(4102)
	"&Open..." Command(4103)
	"&Revert" Command(4104)
	SEPARATOR
	"&Save" Command(4105)
	"Save &As..." Command(4106)
	SEPARATOR
	"Pa&ge Setup..." Command(4107)
	"Print Pre&view..." Command(4114)
	"&Print..." Command(4108)
	SEPARATOR
	"Recent &Files"
	{
		RECENTFILES
		SEPARATOR
		"&Clear Missing Files" Command(5001)
	}
SEPARATOR
"E&xit" Command(4109)
}
"&Edit" Index(1)
{
	"U&ndo" Command(4151)
	"R&edo" Command(4152)
	SEPARATOR
	"&Cut" Command(4153)
	"C&opy" Command(4154)
	"&Paste" Command(4155)
	"Select &All" Command(4157)
	SEPARATOR
	"&Find..." Command(4158)
	"Find Next Do&wn" Command(4159)
	"Find Next &Up" Command(4160)
	"&Replace..." Command(4161)
	"&Go To..." Command(4162)
	SEPARATOR
	"Data"
	{
		"Remove Duplicate &Lines" Call(Lines::RemoveDuplicates)
		"&Reverse Sorting" Call(Lines::Reverse)
		"&Sort Ascending" Call(Lines::SortStrAsc)
		"Sort &Descending" Call(Lines::SortStrDesc)
		"Sort On 1st &Number (Asc)" Call(Lines::SortIntDesc)
		"Sort On &1st Number (Des)" Call(Lines::SortIntDesc)
	}	
	"Insert C&haracter" Command(4163)
	"Insert Da&te" Command(4183)
	"&Selection"
	{
		"Columnar Paste" Command(4192)
		"Ta&b Indent" Command(4165)
		"&Tab Unindent" Command(4167)
		"Spa&ce Indent" Command(4169)
		"Sp&ace Unindent" Command(4171)
		"Delete &First Char" Command(4173)
		"Trim Trailing &Whitespace" Command(4174)
		SEPARATOR
		"&Uppercase" Command(4175)
		"&Lowercase" Command(4176)
		"Se&ntence Case" Command(4177)
		"Title &Case" Command(4178)
		"In&vert Case" Command(4179)
		SEPARATOR
		"Change Codepage..." Command(4182)
	}
	"Newline &format"
	{
		"DOS/Windows (CRLF)" Command(4184)
		"Unix (LF)" Command(4185)
		"Mac (CR)" Command(4186)
	}
	"Harden Word Wrap" Call(Lines::FixWrap)
}
"&View" Index(2)
{
	"&Word Wrap" +Command(4209)
	"Syntax &Highlighting" +Call("Coder::HighLight") Icon("%a\AkelFiles\Plugs\Coder.dll", 0)
	"Code &Folding" +Call("Coder::CodeFold") Icon("%a\AkelFiles\Plugs\Coder.dll", 1)
	"Special Characters" +Call("SpecialChar::Main") Icon("%a\AkelFiles\Plugs\SpecialChar.dll", 0)
	"Text Size &+" Command(4204)
	"Text Size &-" Command(4205)
	SEPARATOR
	"&Bookmarks" Icon("%a\AkelFiles\Plugs\LineBoard.dll", 0)
	{
		"Enable" +Call("LineBoard::Main")
		SEPARATOR
		"Next bookmark" Call("LineBoard::Main::NextBookmark")
		"Previous bookmark" Call("LineBoard::Main::PrevBookmark")
		SEPARATOR
		"Set Bookmark" Call("LineBoard::Main::SetBookmark")
		"Delete Bookmark" Call("LineBoard::Main::DelBookmark")
		"Delete All Bookmarks" Call("LineBoard::Main::DelAllBookmark")
		SEPARATOR
		"Settings..." Call("LineBoard::Settings")
	}	
	"&Explorer Bar" +Call("Explorer::Main") Icon("%a\AkelFiles\Plugs\Explorer.dll", 0)
	"He&x Panel" +Call("HexSel::Main")
	"&Status Bar" +Command(4211)
	"Tool Bar" +Call("ToolBar::Main")
	SEPARATOR
	"S&plit window" Command(4212)
	"&Always On Top" +Command(4210)
}
"&Tools" Index(3)
{
	"&Execute" Command(4251)
	"&Plug-Ins..." Command(4259)
	-"Macros..." +Call("Macros::Main") Icon("%a\AkelFiles\Plugs\Macros.dll", 0)
	-"&Scripts..." +Call("Scripts::Main") Icon("%a\AkelFiles\Plugs\Scripts.dll", 0)
	SEPARATOR
	"Statistics..." Call("Stats::Main")
}		
"&Options" Index(4)
{
	"&General..." Command(4260)
	"&Font..." Command(4201)
	"&Colors..." Command(4202)
	"&Programming..." Call("Coder::Settings") Icon("%a\AkelFiles\Plugs\Coder.dll", 0)
	"&Special Characters..." Call("SpecialChar::Settings") Icon("%a\AkelFiles\Plugs\SpecialChar.dll", 0)
	SEPARATOR
	"Read Only" Command(4216)
	"Keep Left Spaces" Command(4254)
	"Watch File Change" Command(4253)
	"Preserve File Time" Command(4252)
	"Don't Open A File Twice" Command(4255)
	"Don't Open Program Twice" Command(4256)
	SEPARATOR
	"&Window mode"
	{
		"&Single-window (SDI)" Command(4261)
		"&Multi-window (MDI)" Command(4262)
		"&Pseudo multi-window (PMDI)" Command(4263)
	}
}
"&Help" Index(5)
{
	"User Manual" Exec("HH.exe %a\AkelPad4-Eng.chm")
	"Plug-in Manual" Exec("HH.exe %a\Plugins-Eng.chm")
	SEPARATOR
	"&About" Command(4351)
}
I pretty much run mine in SDI mode so I removed a lot of the Windows functions but you can easily put those back if you prefer MDI. I also only work with English documents so the language option is also missing.

Hope it helps someone.

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

keith
I also tried using the "\t" sequence but that did not work either.
Input tab character - in ContextMenu dialog it is inserted with Ctrl+Tab.

Standard main menu with icons available here:
http://akelpad.sourceforge.net/files/plugs/ContextMenu/

Offline
Posts: 9
Joined: Sun Dec 05, 2010 10:09 pm

Post by keith »

Thank you for the icon reference it was a big help.

The CTRL+TAB in the ContextMenu dialog did not seem to have any effect. I am using version 4.51, does the newer version support this?

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

keith
Yes, it should.

Code: Select all

"&New[here press CTRL+TAB]Ctrl+N" Command(4101)

Offline
Posts: 9
Joined: Sun Dec 05, 2010 10:09 pm

Post by keith »

Sorry about that, I went back and tried again and it worked.

It is a bit disappointing in that there is no way to save the hotkeys in an easy to read script like the one above. I even looked in the registry and the INI file and it seems that the program reads/saves the menus in binary format. That certainly makes sense from a performance point of view.

I did however find a small bug when working on this project. I was using a clean version of AkelPad and made all of the changes we noted using the ContextMenu dialog. I clicked OK on the dialog and all of the menus looked correct. I then opened settings and changed from registry to INI. The context menu was reverted back to the original. I made some more changes in INI mode and then switched back to registry. When I made the switch back all of my original changes were still there. I guess the settings update is not triggering ContextMenu or perhaps the main program is not dumping the entire registry. Either way I thought you should know.

BTW - The icon for new window is the same as new document. This can be a bit confusing so your users can also use this: Icon("%windir%\system32\shell32.dll", 2)

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

I did however find a small bug when working on this project. I was using a clean version of AkelPad and made all of the changes we noted using the ContextMenu dialog. I clicked OK on the dialog and all of the menus looked correct. I then opened settings and changed from registry to INI. The context menu was reverted back to the original. I made some more changes in INI mode and then switched back to registry. When I made the switch back all of my original changes were still there. I guess the settings update is not triggering ContextMenu or perhaps the main program is not dumping the entire registry. Either way I thought you should know.
(Neither AkelPad nor plugins does not dump registry. They are reading settings from it(when settings storage is Registry), and then saving settings there(again only if settings storage is Registry).
When you switching AkelPad from one settings storsge to other(INI->Reg or Reg->INI), AkelPad mark this internally(not writing any data). When AkelPad exits correctly, it saves settings into configured storage.
ContextMenu and other plugins save their settings only when it is necessary: when something changes them(via UI or some internals conditions). So if you want pluings to save settings in newly selected storage you should open their settings UI and apply settings there(just press Ok, not changing anything). If you have not did that and reloaded AkelPad, plugins will try to read their settings from new location which is perhaps old or not exists(default values will be loadad).

Offline
Posts: 9
Joined: Sun Dec 05, 2010 10:09 pm

Post by keith »

I would then ask that this be turned into a feature request as it is not very intuitive. It is also one thing that could actually anger a customer. In my case it was no big deal but to others moving their settings from one computer to another might be a little upset if not all of their settings were saved.

I think even you have to admit that cycling through all of your plugin settings can be a little tedious.

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

I think even you have to admit that cycling through all of your plugin settings can be a little tedious.
Yes, may be it is tedious, but I personally will not support this feature request. I already requested such feature in past, but since I developed my first plugin I have changed my mind.

Offline
Posts: 9
Joined: Sun Dec 05, 2010 10:09 pm

Post by keith »

What if I coded the change for you then? Why are you so opposed to the idea?

Offline
Posts: 2247
Joined: Tue Aug 07, 2007 2:03 pm
Location: Vinnitsa, Ukraine

Post by FeyFre »

keith, I cannot explain why in two words. I spent a number of hours developing plugins. I spent a number of hours analysing AkelPad source. And I know one gold rule: if it works then do not touch it without critical necessity. I do not consider your feature request as critical necessity, so will not support.

Offline
Posts: 3217
Joined: Wed Nov 29, 2006 1:19 pm
Location: Киев, Русь
Contact:

Post by VladSh »

keith wrote:I think even you have to admit that cycling through all of your plugin settings can be a little tedious.
It's true. I support you.

warnercraft

Custom Menu?

Post by warnercraft »

Hello,

I have recenltly started using AP, and know nothing about programming yet.

My primary use for AP was to attempt to automate the word processing of large .txt files I receive almost daily from their strict 80 column format to something much less restrictive.

Did I miss something or is the keyboard command to highlight specific columns (blocks) of text missing from the menus? And can this custom menu correct that?

By mere trial and error, and intuition, the command is Alt-Shift-Left Mouse (and drag to highlight the desired column (block).

Thank You

Offline
Posts: 874
Joined: Sat Jan 16, 2010 2:03 pm

Re: Custom Menu?

Post by opk44 »

warnercraft
1) When using the mouse is enough Alt+LMouse (Shift not required)
If you use only the keyboard Alt+Shift+Arrow
And check the word wrap mode is disabled!

2) If you are not afraid to use scripts, then ColumnsDuplicateSelect.js will good for you

warnercraft

Post by warnercraft »

Thanks I will try it out.

My dilemma was that I had used AP months ago, quit for the summer. Came back to it and couldnt remember where I saw the command on how to select the column or block., I couldnt find it in any commands menu, only how to paste it. It seemed like an oversight.

We all know Ctrl S saves, Ctrl C copys, and Ctrl Alt Delete ... well.

When do we get a Ctrl-$ to have a million bucks deposited electronically?
:D
Post Reply