[LDCad] Addon


[LDCad] Addon
#1
Hello!

I've been doing some experiments and Roland suggested I shared them in this forum.

I've done some icons and themes in the past for LDCad. They are usually flat design themes, from several colors, with clear monochromatic icons

[Image: Blue-Theme.png]

But I also wanted to be able to change the color of the titlebar of LDCad window from white, in the example above, to match the color of the menubar. I asked Roland about it but unfortunately that option was not available through the regular configuration files. But his reply about objects and windows class put me in the right track! I research a little and found out Autohotkey, a scripting language for Windows. 

And what started as a pure cosmetic change turned out into a little addon that creates 4 extra buttons on the menubar, some additional hotkeys and the possibility to toggle on/off completely the window titlebar. 

[Image: Dark-Theme.png]
Only works in windows unfortunately

You can see a small video of the addon in action here: https://youtu.be/sDCpDDpfEWY

Here is a brief technical explanation. Autohotkey script grabs LDcad class window and creates an overlay GUI, an extension of the menubar, at a certain position. It creates the extra buttons and show/hides them as necessary. Then registers the mouse clicks and position to change images, cursor and run actions. Pressing the new menubar button will maximize the window, remove titlebar and show additional window control buttons on the menubar (min, restore, close window). It will also register new hotkeys to enable/disable the titlebar, show/hide the menubar, reload script, etc. The autohotkey script is called by a new autorun.lua script also included. So once LDCad loads and finishes updating the PartBin, you'll see a CMD window flash briefly (due to limitations of the io.popen function in the lua script) and the new button will appear on the menubar. Feel free to open the autohotkey script and look around.

Features:
1. New Hotkeys 
- CTRL+T to toggle titlebar
- F11 to toggle menubar (have to config LDCad hotkey show/hide menubar to F10)
- Left Double Click on menubar will maximize/restore window

Requirements:

1. Install Autohotkey
2. Download Addon
3. Download themes (optional)
Blue
Dark
Gray

Instructions:
1. Unzip files inside Titlebar Addon.zip to your LDCad instalation folder
2. Copy autorun.lua to your profile LDCad global script folder i.e %appdata%\Roaming\LDCad\scripts\default\global
3. Edit autorun.lua and change path to your LDCad.exe accordingly
4. Depending on your buttons of the menu bar, you might have to adjust the origin of the new complement menubar.
- Open autorun.ahk with a text editor
- Find line 21, code "MenuPos = 1338"
- Change value "1338" for what suits you best. Increasing the number will move origin to the right. Decreasing will move to the left
 

Let me know if you need extra help in setting this up.

Hope you enjoy!
Reply
RE: [LDCad] Addon
#2
(2019-09-19, 11:37)Miguel Reizinho Wrote: Hello!

I've been doing some experiments and Roland suggested I shared them in this forum.

I've done some icons and themes in the past for LDCad. They are usually flat design themes, from several colors, with clear monochromatic icons

[Image: Blue-Theme.png]

But I also wanted to be able to change the color of the titlebar of LDCad window from white, in the example above, to match the color of the menubar. I asked Roland about it but unfortunately that option was not available through the regular configuration files. But his reply about objects and windows class put me in the right track! I research a little and found out Autohotkey, a scripting language for Windows. 

And what started as a pure cosmetic change turned out into a little addon that creates 4 extra buttons on the menubar, some additional hotkeys and the possibility to toggle on/off completely the window titlebar. 

[Image: Dark-Theme.png]
Only works in windows unfortunately

You can see a small video of the addon in action here: https://youtu.be/sDCpDDpfEWY

Here is a brief technical explanation. Autohotkey script grabs LDcad class window and creates an overlay GUI, an extension of the menubar, at a certain position. It creates the extra buttons and show/hides them as necessary. Then registers the mouse clicks and position to change images, cursor and run actions. Pressing the new menubar button will maximize the window, remove titlebar and show additional window control buttons on the menubar (min, restore, close window). It will also register new hotkeys to enable/disable the titlebar, show/hide the menubar, reload script, etc. The autohotkey script is called by a new autorun.lua script also included. So once LDCad loads and finishes updating the PartBin, you'll see a CMD window flash briefly (due to limitations of the io.popen function in the lua script) and the new button will appear on the menubar. Feel free to open the autohotkey script and look around.

Features:
1. New Hotkeys 
- CTRL+T to toggle titlebar
- F11 to toggle menubar (have to config LDCad hotkey show/hide menubar to F10)
- Left Double Click on menubar will maximize/restore window

Requirements:

1. Install Autohotkey
2. Download Addon
3. Download themes (optional)
Blue
Dark
Gray

Instructions:
1. Unzip files inside Titlebar Addon.zip to your LDCad instalation folder
2. Copy autorun.lua to your profile LDCad global script folder i.e %appdata%\Roaming\LDCad\scripts\default\global
3. Edit autorun.lua and change path to your LDCad.exe accordingly
4. Depending on your buttons of the menu bar, you might have to adjust the origin of the new complement menubar.
- Open autorun.ahk with a text editor
- Find line 21, code "MenuPos = 1338"
- Change value "1338" for what suits you best. Increasing the number will move origin to the right. Decreasing will move to the left
 

Let me know if you need extra help in setting this up.

Hope you enjoy!


Those look AWESOME! Would it be possible to put this as tutorial on the wiki? Drop me a line if you have problems with setting up an account.

Obviously it would be best if LDCad would ship with the possibility to select those skins from within the prog with no need to do all those hacking ... don't listen to me just dreaming aloud ;-)

w.
LEGO ergo sum
Reply
RE: [LDCad] Addon
#3
(2019-09-19, 15:41)Willy Tschager Wrote: Those look AWESOME! Would it be possible to put this as tutorial on the wiki? Drop me a line if you have problems with setting up an account.

Obviously it would be best if LDCad would ship with the possibility to select those skins from within the prog with no need to do all those hacking ... don't listen to me just dreaming aloud ;-)

w.

Thank you!  

There are really just two things that can be considered "hacking", even if it's only editing two text files ;-)

1. Editing the autorun.lua to change your LDCad path
2. Editing the autorun.ahk to change your starting X position of the new GUI

All the rest is just copying the files to the right place or folders as documented in LDCad tutorials. Themes to the "gui" folder and scripts to the "global" folder. 

After doing that the themes and titlebar macro become available through LDCad menus:
[Image: Themes.png]    [Image: Scripts.png]

But back to the "hacking"...

For item 1., editing autorun.lua script, perhaps Roland can help. Hopefully there is a Path System Variable available that can be used instead of having to write it on the file for each user.

For item 2., about the X positioning of the new GUI, I'm already thinking of an updated version. The new version would add the new button in the menubar and check the screen resolution to display it ALIGNED TO THE RIGHT of the LDCad window. Once clicked, this button would be replaced by the window controls (min, max/restore, close). Because I just realized: having the restore button or the toggle titlebar button is redundant since they both will have the same effect if clicked.
Reply
RE: [LDCad] Addon
#4
(2019-09-19, 16:38)Miguel Reizinho Wrote: After doing that the themes and titlebar macro become available through LDCad menus:
[Image: Themes.png]    [Image: Scripts.png]
Yes, theming is supported in current LDCad version... I use Miguel's dark theme for a while Wink
Reply
RE: [LDCad] Addon
#5
And it's done! Version 2.0. No more "hacking" needed. Just copy the files to the LDCad folder and the lua script to the global scripts folder.

New version can be downloaded from HERE.

This version will detect the screen resolution and insert a new button (Toggle Titlebar) on the menubar at the rightmost position. When you click that button, LDCad window is maximized,  titlebar is removed and the new button will be replaced by the window control box (min, restore, close).

When LDCad window is restored, titlebar is also restored and window control box is hidden.

Also changed hotkey config. Now you just press F11 to Show/Hide the titlebar. CTRL+F11 will Show/Hide LDCad menubar completely. You must configure LDCad Hotkey Show/Hide Menubar to F10 for this to work. Also be sure that you don't have any other LDCad hotkeys configured to F11.
Reply
RE: [LDCad] Addon
#6
Ain't workin:

   


w.
LEGO ergo sum
Reply
RE: [LDCad] Addon
#7
(2019-09-23, 14:37)Willy Tschager Wrote: Ain't workin:




w.

Sorry for the late reply. I've just returned from the Skaerbaek Fan Weekend.

I think you're not copying the file autorun.ahk to your LDCad.exe folder...

From the ReadMe.txt file:

Quote:- Copy "Images" folder and "autorun.ahk" to the same folder where LDCad.exe is located (installation folder)
Reply
RE: [LDCad] Addon
#8

.png   LDCad_Hotkey2.png (Size: 12.55 KB / Downloads: 212)

Did I tell you that I work with the 32 bit version?

w.
LEGO ergo sum
Reply
RE: [LDCad] Addon
#9
(2019-10-01, 10:47)Miguel Reizinho Wrote: Sorry for the late reply. I've just returned from the Skaerbaek Fan Weekend.

I think you're not copying the file autorun.ahk to your LDCad.exe folder...

From the ReadMe.txt file:

Looking at the autorun.lua script, there seems to be a hard coded path "C:\\Dropbox\\LDraw\\LDCad\\Launcher.ahk" that may be the issue.
Reply
RE: [LDCad] Addon
#10
(2019-10-02, 14:01)Orion Pobursky Wrote: Looking at the autorun.lua script, there seems to be a hard coded path "C:\\Dropbox\\LDraw\\LDCad\\Launcher.ahk" that may be the issue.

Nope. That line is commented out. 

Quote:--os.execute("C:\\Progra~1\\AutoHo~1\\AutoHotkey.exe C:\\Dropbox\\LDraw\\LDCad\\Launcher.ahk")

os.execute function is not supported in LDCad
Reply
RE: [LDCad] Addon
#11
(2019-09-20, 10:16)Miguel Reizinho Wrote: And it's done! Version 2.0. No more "hacking" needed. Just copy the files to the LDCad folder and the lua script to the global scripts folder.

New version can be downloaded from HERE.

This version will detect the screen resolution and insert a new button (Toggle Titlebar) on the menubar at the rightmost position. When you click that button, LDCad window is maximized,  titlebar is removed and the new button will be replaced by the window control box (min, restore, close).

When LDCad window is restored, titlebar is also restored and window control box is hidden.

Also changed hotkey config. Now you just press F11 to Show/Hide the titlebar. CTRL+F11 will Show/Hide LDCad menubar completely. You must configure LDCad Hotkey Show/Hide Menubar to F10 for this to work. Also be sure that you don't have any other LDCad hotkeys configured to F11.

Interesting.
Strangely enough, my Firewall / Anti-virus won't let me download the file from tinyupload though. Warns me about malicious malware and stuff?
Could you share in other way or PM me please?
Jaco van der Molen
lpub.binarybricks.nl
Reply
RE: [LDCad] Addon
#12
(2019-09-20, 10:16)Miguel Reizinho Wrote: And it's done! Version 2.0. No more "hacking" needed. Just copy the files to the LDCad folder and the lua script to the global scripts folder.
Unfortunately for me, the needed "hacking" starts with MS Windows installation. Sad This is no-go for me, I still remember that pain when I needed extra virtual machine with MSW for SR3D Builder.

As I do not see any negative comment about this addon, everybody looks enjoying it - can it be added directly into LDCAD code and made available for all platforms then? Roland, please?
Reply
RE: [LDCad] Addon
#13
(2019-10-05, 0:27)Milan Vančura Wrote: Unfortunately for me, the needed "hacking" starts with MS Windows installation. Sad This is no-go for me, I still remember that pain when I needed extra virtual machine with MSW for SR3D Builder.

As I do not see any negative comment about this addon, everybody looks enjoying it - can it be added directly into LDCAD code and made available for all platforms then? Roland, please?
The black theme can be used in the Linux version too.

AutoHotKey seems to be Windows only though.

I'll check if I can do the 'window frame title bar removal' with wxWidgets natively for the 1.6d version.

If it's (easily) possible I'll add an option for it.
Reply
RE: [LDCad] Addon
#14
(2019-10-06, 17:46)Roland Melkert Wrote: I'll check if I can do the 'window frame title bar removal' with wxWidgets natively for the 1.6d version.
Thank you for checking it, Roland. It would be really helpful.
Reply
RE: [LDCad] Addon
#15
为什么无法显示主题?帮我谢谢你


Attached Files Thumbnail(s)
           
Reply
RE: [LDCad] Addon
#16
(2020-03-17, 2:57)Lidong Wrote: Why can't the theme be displayed? Help me thank you

Did you also install the dark, blue and / or gray theme packs?

Did you mean to have a loose color bin wheel and no part bin? If not you can easily reset things by deleting the

%appdata%/LDCad/config/main.cfg

file.
Reply
RE: [LDCad] Addon
#17
Which folder do I need to put the theme pack in?  Thank you
Reply
RE: [LDCad] Addon
#18
(2020-03-18, 2:55)Lidong Wrote: Which folder do I need to put the theme pack in?  Thank you

%appdata%/LDCad/gui

Make sure it's unpacked in it's own subfolder, for example:

%appdata%/LDCad/gui/Dark

and there are no further subfolders in there.
Reply
RE: [LDCad] Addon
#19
如何打开这个界面?谢谢


Attached Files Thumbnail(s)
   
Reply
RE: [LDCad] Addon
#20
(2020-03-20, 9:18)Lidong Wrote: How to open this interface? Thank you

It's a split view. You can apply that by using the options in the top menu bar's view menu. Then select "editing view" and then "split".

The layout in the picture uses a vertical split, with a horizontal split in its right side.

When you got the 3 views you can change the right ones to 2D using their compass in the corner (click the 3d label)
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 2 Guest(s)