GiD - The personal pre and post processor
Asking for images
Use in your module the same image as GiD use
In order to use an image that GiD use, you must use the tcl function gid_themes::GetImage, to see a complete list of images available you can take a look for example to the folder:
(GiD Folder)\themes\GiD_classic\images\large_size(24andmore)
proc gid_themes::GetImage { filename IconCategory }
IconCategory could be: "small_icons", "medium_icons", "large_icons", "menu", "toolbar"
There is another IconCategory, "generic", that is the category used when the parameter is omitted. Using this category the image is retrieved from root image folder (Example: (GiD Folder)\themes\GiD_classic\images\ ), but the use of this category its not recommended, since images from root folders are not guaranteed on future versions.
The corresponding folder for each icon category is defined on the configuration of theme (will be one of the subfolders inside image folder)
Example: To get surface image for use on a button.
gid_themes::GetImage surface.png toolbar
This will return appropriate image depending on current theme, it could be for example:
(GiD Folder)\themes\GiD_classic\images\large_size(24andmore)\surface.png
Use in your module your own images
If your module needs other images from ones supplied by GiD
You can use:
gid_themes::GetImageModule to get the appropriate image, from inside the module folder, depending on current theme.
gid_themes::GetImage { full_path_filename } , image will be equal regardless of current theme. This is the 'old style', with the module images stored as module developer want, without follow the previously recommended folder layout.
Note: the full_path_filename points to a 'module' file, but it must be build in a relative way, based on the problemtype location.
e.g.
proc InitGIDProject { dir } { set full_path_filename [file join $dir my_images_folder my_image.png] set img [gid_themes::GetImage $full_path_filename] ... }
To use proc gid_themes::GetImageModule { filename IconCategory }, you must replicate folder structure of (GiD Folder)\themes\ inside your module folder.
inside each theme must be a configuration.xml file (could be a copy of the one found in GiD) but also can be configured with only the following parameters:
<MODULE_THEME name="GiD_classic"> <version>1.1</version> <alternative_theme>GiD_black</alternative_theme> <SizeDefinitions> <SizeDefinition name='small_size'> <label>small size</label> <folder>small_size(16andmore)</folder> <alternative_folder>GiD_black/images/size16</alternative_folder> </SizeDefinition> <SizeDefinition name='large_size'> <label>large size</label> <folder>large_size(24andmore)</folder> <alternative_folder>GiD_black/images/size24</alternative_folder> </SizeDefinition> </SizeDefinitions> <IconCategories> <menu>small_size</menu> <toolbar>large_size</toolbar> <small_icons>small_size</small_icons> <large_icons>large_size</large_icons> </IconCategories> </MODULE_THEME>
The option "alternative_theme" its used if some file its not found, for try to find on the alternative theme (example themes still on develop )
Also using this redirection, a complete themes that module is not interested on can be redirected to our main theme, in this case we will need just 1 folder for each theme and configuration.xml inside it.
Note: for high resolution displays, with high DPI, check also the proc gid_themes::getDefaultHighResolutionScaleFactor {} to scale you images. This functions returns a scale factor, which may be changed by the user in the preferences window, you'll need to scale your custom images and fonts. This factor is initially set to a value so that the medium theme size icons are legible in high DPI screens.
The above mentioned functions, gid_themes::GetImage and gid_themes::GetImageModule already take into account this factor.
COPYRIGHT © 2022 · GID · CIMNE