Gimp plugin in C++ : how to have an input from the user? - c++

I would like to make a watermark plugin in GIMP. I need to have the text of the watermark as input from the user. I'll try with g_message but it is not working: I can't read an input from user in the plugin.
Can you help?
Best regards.
Jean.

I assume your plug in already runs and "just" needs to have the possibility to ask the user to provide a string. The easiest solution would be to add a string as input parameter - this way GIMP takes care about showing the dialog to the user before calling your script. This can be done via the gimp_install_procedure(...) call that I assume you are using, specifically the params parameter of this function: This is an array of GimpParamDef structs where you specify the type (PF_STRING), name ("text") and description ("text of watermark") of your input parameter.

Related

How to write tab command in c++ to switch input form

I have a database and I want to add that data to a web application using ditto. I copied the data from my domain for me to paste in someone else's domain. With a semicolon separator.
So, I want when the text is pasted, the semicolon changes to the tab command to the next input form. Please help.
Description is in the image in the attachment. Thank you.
DITTO SCRIPT
INPUT FORM
You could try using a vector as a buffer if you're working with ascii characters. just do the same comparisons with a for each loop.

UI: Separating Multiple Inputs With Comma

I am wondering how to achieve this with Flask and WTForms for UI purposes. This input takes up to 10 responses separated by comma. enter image description here
I hope for each response to be cemented in the input after the user types in a comma for UI purposes (I can handle it on the backend). So for example, they type in "Red," and "Red" is cemented in the input with the ability to delete it. Any library suggestions or ideas on how I should attack this?
You would need JavaScript to do this. This question might be of some help: Dynamically check text input. I would do a search on dynamically checking text input.

Can I use a variable as a text property when calling class window?

I have a child object class window with a parameter regexptitle, so text being changed dynamically depending on the regular expression. I need to check if this window is opened and active using variable. I tried to put there string but it didn't help. Please help me find a solution.
Example of code repeated:
If Window("Excel").Window("Prompts for Project Analysis"). Exist Then ...
If Window("Excel").Window("Prompts for Engagements"). Exist Then ...
Assuming I read your question correctly, you should be able to achieve the goal using descriptive programming with this:
If Window("Excel").Window("regexptitle:=Prompts for.*"). Exist Then
Or if you have at least one version of the window learned in the object repository, add the regexptitle property to the test object details under Description properties, set it to a regular expression and set its value to be "Prompts for.*" - this will cause UFT to recognise all windows of this class with a regexptitle beginning "Prompts for" as this object (assuming the other recognition properties match up as well, and you get to use the OR-friendly object name in your code.
Let me know if that works for you, or if you need further help.

joomla: customize text in user menu

In the user-menu module, I want to change the text in the div.login-greeting element (which is a child of the form#login-form element).
Right now, it says "Hi Steph," (supposing the username is Steph)
I want it to say "Hi, Steph".
That's all.
I can't figure out if what I need to do is a template override or something else... because I can't figure out where the heck these elements come from. I am fairly new to Joomla, and intermediate in php. I've found working with the module manager, adding class suffixes, placing module positions in index.php, etc. all quite straightforward. I did a template override for the login module, with no trouble. But the menu module is baffling me. Looking at the default.php, I can't even figure out how it puts the form in there when it's a user-menu and not just a normal menu. Where does this form come from?? How can I change it???
Go to language>en-GB>en-GB.mod_login.ini and change MOD_LOGIN_HINAME="Hi %s," to MOD_LOGIN_HINAME="Hi, %s" and save the file.
EDIT
If you need to change more strings it's better to create a file en-GB.override.ini inside language/overrides and put only the strings that you want to override from any extension. For example it might contain only:
MOD_LOGIN_HINAME="Hi, %s"
MOD_LOGIN_REGISTER="Click here to register"

How to override the default text in MATLAB

In MATLAB, when you click File -> New -> Function M-File, you get a file with the following contents:
function [ output_args ] = Untitled( input_args )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
end
Is it possible to override this behaviour, and specify your own text?
(The motivation is that I'm trying to persuade my colleagues to document their m-files more thoroughly, and having default text for them to fill in might encourage them.)
I didn't even know File->New->Function did that.
The way I solved the issue was to write a function that you call via
>>newFunction myNewFunctionName
It then
pops up an inputdlg window, which asks the user for the synopsis and the H1 line and allows to already write help to explain input and output arguments. There, the user also selects whether myNewFunctionName is a function or a class in order to choose the right header and 'function call'
checks whether a function of the same name exists already
asks for a folder to save the function, and
opens the function in the editor
The header is set up so that it's easy to fill in info about input and output. It also automatically lists the username of the person who created the file as well as the date and the Matlab version.
EDIT
For new classes, the template function automatically makes sure that they subclass my general superclass that implements methods such as 'help' (which calls doc(class(obj)) )
Now if the template functionwould also write the algorithm part of the function, it would be really convenient. :)
EDIT2
Here's a link to the function on the file exchange.
I would suggest making your own default m-file template, called default.m for example, and placing it in a folder on the MATLAB path where your colleagues can access it. You should then set the file to be read-only. Your colleagues can then execute any one of the following commands in the MATLAB Command Window when they want to create a new function m-file:
open default.m
open('default.m')
edit default.m
edit('default.m')
The functions OPEN and EDIT will open a file in the MATLAB Editor. Since the file default.m is read-only, if anyone tries to save over it they will get a dialog box warning them as such and asking them to save to a new file (or overwrite it). That should keep them from accidentally modifying the template.
I searched through all text files starting from matlabroot folder, but could not find that template. Seems it's hard-coded, which is weird.
I like Jonas approach. As my two cents, you can download a function (not mine) doing similar things with some customization from here.
After more pondering, I've come up with a solution that I'm happy with, combining Jonas' and gnovice's answers. It's a function that creates a new m-file (with template documentation), and opens it in the editor. It is available from the Matlab Central File Exchange.