Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

Removal of ID_ProjectManager, any other way to hook into an event w/o ID?

(1/1)

secks:
The ID_ProjectManager has been removed from the projectmanager.h file .. I had a plugin that was using this ID to register for EVT_TREE_ITEM_EXPANDING .. The plugin does 2 things .. One, (which is should really be fixed in c::b) fixes a linux bug where some files (including *.h) files are a dark color in the projectmanager tree even tho my gnome/gtk theme is dark (dark text on dark background = no bueno!) .. the plugin then forces the text color to white .. also, we have our own proprietary source control/filesystem at my company, and i was leveraging that event to update icons/text/properties when the tree was expanded .. I can definitely work around these issues with timers, hooking onto other events, etc, but it would still be kinda neat to be able to hook into the projectmanager's tree's events ..

Is there another method I can use to hook into a controls event without having it's ID handy?

oBFusCATed:
1. The color can be changed in the Settings -> Env -> Colours -> Project Tree : Non-compiled files
2. Do you need anything else than a expand/collapse events and an API to change icons?
3. You can probably use GetUI().GetTree()->GetID() to get to the ID of the window.

secks:
1) Thanks, had no idea that even existed lol ..
2) I already have the method needed to change icons/text/colors of the tree items, i just dont have the expand event that i leveraged anymore .. The reason I used the expand event is because the filesystem/sourcecontrol check I have to execute to get the states (which icons, text, etc) is very expensive, so I was able to only process the update on items contained within a node (instead of all projects/files) ..
3) That was good enough to solve my issue, thanks!

My event registration changed from:

--- Code: ---EVT_TREE_ITEM_EXPANDING(ID_ProjectManager, YBCBPlugin::OnPrjMgrTreeItemExpanding)
--- End code ---
to this:

--- Code: ---EVT_TREE_ITEM_EXPANDING(Manager::Get()->GetProjectManager()->GetUI().GetTree()->GetId(), YBCBPlugin::OnPrjMgrTreeItemExpanding)
--- End code ---
The only concern I have is there is no protection from this not returning null (due to the event-reg code fires when the sharedobject/plugin is loaded into mem:

--- Code: ---Manager::Get()->GetProjectManager();
--- End code ---

oBFusCATed:
I think you're safe with this.

secks:

--- Quote from: oBFusCATed on September 06, 2013, 12:52:42 am ---I think you're safe with this.

--- End quote ---
I think you're right .. I tested it and seems right .. no crashes, and I'm still getting the events .. thanks for your help!


paul

Navigation

[0] Message Index

Go to full version