Hello folks ... This note may not be seen by too many Dillo aficionados, because most of you will no doubt be exercising your invitations to the British Royal Wedding. :) Please convey my best wishes to the Royal couple, and have a glass of "cold punch" on me! Now back to regularly scheduled programming ... How hard would it be to add a button or menu items that would allow for the editing of a page being currently viewed, the the option to declare an external editor in ~/.dillo/dillorc? -- Duke
On Fri, 29 Apr 2011 09:54:02 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
How hard would it be to add a button or menu items that would allow for the editing of a page being currently viewed, the the option to declare an external editor in ~/.dillo/dillorc?
Fairly easy -- there's only two things to consider: (1) It would need to get the page source to the editor somehow, probably using a temporary file. (2) Different platforms have different ways to start external applications: Unix uses fork() / exec(), while Windows uses CreateProcess(). Dillo already has the code for both. (1) is easy enough to accomplish, just use the existing "save to disk" function and instead of prompting the user, randomly generate a temporary filename. (2) is already needed for DPI, and it would be easy enough to write a "portability wrapper" similar to what I did with the sockets code in my Windows port. There are a couple other small details -- picking a reasonable default editor (or maybe just internal "view source" if none specified?), and starting a terminal emulator for console editors like vi, nano, emacs, etc. Besides that, you'd just need to write the code or get one of the developers interested. As it happens, I've been thinking of implementing that feature for a while now... :-) Cheers, ~Benjamin
On Fri, 29 Apr 2011, Benjamin Johnson wrote:
On Fri, 29 Apr 2011 09:54:02 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
How hard would it be to add a button or menu items that would allow for the editing of a page being currently viewed, the the option to declare an external editor in ~/.dillo/dillorc?
Fairly easy -- there's only two things to consider:
[snip the good stuff] :) It always looks "so easy" when you know what you're doing - doesn't it! I don't know C or C++ at all - just Perl, PHP, newLISP and some Ruby - but I'm willing to learn.
There are a couple other small details -- picking a reasonable default editor (or maybe just internal "view source" if none specified?), and starting a terminal emulator for console editors like vi, nano, emacs, etc.
I would simply set up an "editor" option in "dillorc". If it's empty then "view source"; otherwise send the file to the preferred editor.
Besides that, you'd just need to write the code or get one of the developers interested. As it happens, I've been thinking of implementing that feature for a while now... :-)
I pulled the source code to my system using mercurial (for the first time). If someone would point out the files that I need to hack, I sure could try. Might be a way to learn C and the required tool-chain. -- Duke
On Fri, 29 Apr 2011 10:53:24 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
I pulled the source code to my system using mercurial (for the first time). If someone would point out the files that I need to hack, I sure could try. Might be a way to learn C and the required tool-chain.
Well, if you're feeling ambitious: - Add a "char *editor" value or similar to struct _DilloPrefs in src/prefs.h. - Initialize and free this value in a_Prefs_init() and a_Prefs_freeall(), respectively, in src/prefs.c. - Add an entry for this value in const SymNode_t symbols[] in src/prefsparser.cc. - Hack up a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url) in src/uicmd.cc to check for the editor value, and if present, launch the editor. I'll leave this for you to figure out, but the exec(3) manpage might help ;-) (actually I don't mind helping, just email if you need anything) If you know Perl and PHP, C/C++ shouldn't be hard to figure out. PHP borrows a lot of C's syntax (I think Perl does, too, but I'm not a Perl programmer), so mostly it's just the type system and memory management. Dillo's actually a pretty good codebase to learn on, because it's fairly small and well-organized; I've learned quite a bit working on it myself. But don't worry about all that if you don't want to -- I was thinking of writing a patch anyway, once I finish with exams. I should probably update my code to 1.3... ~Benjamin
On Fri, 29 Apr 2011, Benjamin Johnson wrote:
On Fri, 29 Apr 2011 10:53:24 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
I pulled the source code to my system using mercurial (for the first time). If someone would point out the files that I need to hack, I sure could try. Might be a way to learn C and the required tool-chain.
Well, if you're feeling ambitious:
- Add a "char *editor" value or similar to struct _DilloPrefs in src/prefs.h.
- Initialize and free this value in a_Prefs_init() and a_Prefs_freeall(), respectively, in src/prefs.c.
- Add an entry for this value in const SymNode_t symbols[] in src/prefsparser.cc.
- Hack up a_UIcmd_view_page_source(BrowserWindow *bw, const DilloUrl *url) in src/uicmd.cc to check for the editor value, and if present, launch the editor. I'll leave this for you to figure out, but the exec(3) manpage might help ;-) (actually I don't mind helping, just email if you need anything)
If you know Perl and PHP, C/C++ shouldn't be hard to figure out. PHP borrows a lot of C's syntax (I think Perl does, too, but I'm not a Perl programmer), so mostly it's just the type system and memory management. Dillo's actually a pretty good codebase to learn on, because it's fairly small and well-organized; I've learned quite a bit working on it myself.
It'll be fun trying! Thanks for the tips. So the workflow will be: - update the source with: hg update ??? - hack as per above - make check That should leave the working version of Dillo alone? After "make check" is there an executable is the source tree that I try out? -- Duke
On Fri, 29 Apr 2011 11:54:45 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
It'll be fun trying! Thanks for the tips.
So the workflow will be:
- update the source with: hg update ??? - hack as per above - make check
That should leave the working version of Dillo alone? After "make check" is there an executable is the source tree that I try out?
As long as the working version's not in the source tree, you're good. (i.e. if it's in /usr/local/bin) The executable is ./src/dillo -- what I usually do is make && ./src/dillo which attempts to build it, then runs it if the build was successful. ~Benjamin
On Fri, 29 Apr 2011, Benjamin Johnson wrote:
On Fri, 29 Apr 2011 11:54:45 -0400, Duke Normandin <dukeofperl@ml1.net> wrote:
It'll be fun trying! Thanks for the tips.
So the workflow will be:
- update the source with: hg update ??? - hack as per above - make check
That should leave the working version of Dillo alone? After "make check" is there an executable is the source tree that I try out?
As long as the working version's not in the source tree, you're good. (i.e. if it's in /usr/local/bin)
The executable is ./src/dillo -- what I usually do is make && ./src/dillo
which attempts to build it, then runs it if the build was successful.
Much obliged! Thanks. -- Duke
participants (2)
-
dukeofperl@ml1.net
-
obeythepenguin@gmail.com