GUI for editing program file

The place for chatting and discussing subjects unrelated to Wesnoth.

Moderator: Forum Moderators

Post Reply
User avatar
max_torch
Inactive Developer
Posts: 414
Joined: July 31st, 2011, 5:54 pm

GUI for editing program file

Post by max_torch »

How do I make a GUI that when opened, will have dropboxes, textboxes, etc, apply button at the bottom, that will allow me to change certain parameters/lines of a program file (which can be opened with notepad) once I click apply, rather than having to manually open the program and type in the changes each time.
Kinda like a program configuration GUI.
Like for example there is a line

movlw d'6'

I would like to have a textbox in the GUI where I can just type in the number I want to change d'6' to and when I click apply it will automatically edit the .asm file (which can be opened using notepad).
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: GUI for editing program file

Post by Elvish_Hunter »

I must admit, I had to read your post several times to exactly understand what you were looking for. :oops: Then, I got it: what you want is the sed Unix command (it's not a GUI, though).
In your case, if you want to replace d'6' with d'10', you'll have to type something like this in Bash:

Code: Select all

sed -i 's/movlw d\'6\'/movlw d\'10\'/' myfile.asm
The -i switch tells the command to do the replacements in place (edit the original file); the exact command may vary depending on your needs, and one must always read the documentation and do a backup before copypasting code.
Now, I suppose that you're on Windows, since you're talking about Notepad: in this case, Windows users can get access to sed either through Cygwin or the GnuWin32 projects.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: GUI for editing program file

Post by iceiceice »

max_torch: You can also try using "find and replace" feature if notepad has that? It should be very close to what you asked for.

If notepad does not have that feature, you could try installing a better text editor. I guess it's common to recommend Notepad++ although I have no personal experience with that.

I can report that the ubuntu default text editor is more than adequate :D
User avatar
GunChleoc
Translator
Posts: 506
Joined: September 28th, 2012, 7:35 am
Contact:

Re: GUI for editing program file

Post by GunChleoc »

I like to use Geany, it is available on Linux, Windows and Mac.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: GUI for editing program file

Post by gfgtdf »

max_torch:

I don't know how good your programming skills are, but i'd reccoment to change the programm (the one that you want to change) to have a textbox that lets you specify the value instead of hardcoding it in your source file.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: GUI for editing program file

Post by ancestral »

You might look around for IDEs and apps which help you manage interfaces in the programming languages you are familiar with.

You might also check out Tcl/Tk as it’s easy to create interfaces with pure text files.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
Post Reply