aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-gtk.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-03-16implemented automatic EOL translation supportRobin Haberkorn1-1/+1
* activated via bit 4 of the ED flag (enabled by default) * automatic EOL guessing on file loading and translation to LFs. * works with files that have inconsistent EOL sequences. * automatic translation to original EOL sequences on file saving * works with inconsistent EOL sequences in the buffer. This should usually not happen if the file was read in with automatic EOL translation enabled. * also works with the EC and EG commands * performance is OK, depending on the file being translated. When reading files with UNIX EOLs, the overhead is minimal typically-sized files. For DOS EOLs the overhead is larger but still acceptable. * Return (line feed) is now an immediate editing command. This centralizes EOL sequence insertion. Later, other features like auto-indent could be added to the editing command. * get_eol() has been moved to main.cpp (now called get_eol_seq() * Warn if file ownership could not be preserved when saving files. * IOView has been almost completely rewritten based on GIOChannels. The EOL translation code is also in IOView.
2015-03-10avoid frequent info line redraws in Curses and GTK+ UIsRobin Haberkorn1-14/+19
* it is now redrawn once after each key press, even if the info line has not changed. * This is because Interface::update_info() is called very often in interactive mode, so it makes more sense to redraw it after user interaction (where even unnecessary delays are not noticed so easily), than thousands of times in a macro. * This is especially important since InterfaceCurses::update_info() now also sets the Window title on PDCurses - this is a very costly operation. * The same optimization was applied to InterfaceGtk where it is probably greatly responsible for the sluggishness of the UI. The GTK+ changes are currently UNTESTED.
2015-03-10optimized Interface::info_update() implementationsRobin Haberkorn1-10/+12
* use g_strconcat() instead of g_strdup_printf() * InterfaceGtk::info_update() now longer has an arbitrary 255 byte limit on the length of the info line.
2015-03-09fixed displaying of control characters in the "info" line (and window title)Robin Haberkorn1-2/+6
* this relied on Curses' control character drawing on Curses. However it treats tab and line feed differently than other control characters, so registers like "^Mfoo" could not be displayed properly. Even if we can configure Curses to display them correctly, we need a "canonicalized", flat form of strings for other purposes (like setting window titles. This is form is different from the formatting used for command lines which may change anyway once we introduce Scintilla mini buffers. * therefore String::canonicalize_ctl() was introduced * also set window title on PDCurses
2015-03-07Curses UI: fixed translation of the backspace keyRobin Haberkorn1-1/+1
* for historic reasons, the backspace key can be transmitted as ^H by the terminal. Some terminal emulators might do that - these are fixed by this commit. * Use CTL_KEY('H') instead of standard C '\b' as the former is less ambiguous given the confusion around the backspace character.
2015-03-07cleaned up usage of the escape control character: introduced CTL_KEY_ESC and ↵Robin Haberkorn1-2/+2
CTL_KEY_ESC_STR * the reason for the CTL_KEY() macro is to get the control character resulting from a CTRL+Key press -- at least this is how SciTECO presents these key presses. It is also a macro and may be resolved to a constant expression, so it can be used in switch-case statements. Sometimes it is clearer to use standard C escape sequences (like '\t'). * CTL_KEY('[') for escape is hard to read, so I always used '\x1B' which is even more cryptic.
2015-03-01keep rubbed out command line for later re-insertion and massive Cmdline ↵Robin Haberkorn1-19/+69
cleanup/refactoring * characters rubbed out are not totally removed from the command line, but only from the *effective* command line. * The rubbed out command line is displayed after the command line cursor. On Curses it is grey and underlined. * When characters are inserted that are on the rubbed out part of the command line, the cursor simply moves forward. NOTE: There's currently no immediate editing command for reinserting the next character/word from the rubbed out command line. * Characters resulting in errors are no longer simply discarded but rubbed out, so they will stay in the rubbed out part of the command line, reminding you which character caused the error. * Improved Cmdline formatting on Curses UI: * Asterisk is printed bold * Control characters are printed in REVERSE style, similar to what Scinterm does. The controll character formatting has thus been moved from macro_echo() in cmdline.cpp to the UI implementations. * Updated the GTK+ UI (UNTESTED): I did only, the most important API adaptions. The command line still does not use any colors. * Refactored entire command line handling: * The command line is now a class (Cmdline), and most functions in cmdline.cpp have been converted to methods. * Esp. process_edit_cmd() (now Cmdline::process_edit_cmd()) has been simplified. There is no longer the possibility of a buffer overflow because of static insertion buffer sizes * Cleaned up usage of the cmdline_pos variable (now Cmdline::pc) which is really a program counter that used a different origin as macro_pc which was really confusing. * The new Cmdline class is theoretically 8-bit clean. However all of this will change again when we introduce Scintilla views for the command line. * Added 8-bit clean (null-byte aware) versions of QRegisterData::set_string() and QRegisterData::append_string()
2015-02-11updated copyright to 2015Robin Haberkorn1-1/+1
2014-11-21finally implemented the CLOSE and QUIT hooksRobin Haberkorn1-15/+29
the QUIT hook is actually not that trivial and required some architectural changes. First, the QUIT hook execution and any error that might occurr cannot always be attached to an existing error stack frame. Thereforce, to give a stack frame for QUIT hooks and to improve the readability of error traces for ED hooks in general, a special EDHookFrame is added to every ED hook execution error. Secondly, since QUIT hooks can themselves throw errors, we cannot run it from an atexit() handler. Instead it's always called manually before __successful__ program termination. An error in a QUIT hook will result in a failure return code nevertheless. Thirdly, errors in QUIT hooks should not prevent program termination (in interactive mode), therefore they are only invoked from main() and always in batch mode. I.e. if the interactive mode is terminated (EX$$), SciTECO will switch back to batch mode and run the QUIT hook there. This is also symmetric to program startup, which is always in batch mode. This means that Interface::event_loop() no longer runs indefinitely. If it returns, this signals that the interface shut down and batch mode may be restored by SciTECO.
2014-11-17Make sure QRegister::view is properly initialized and cleaned upRobin Haberkorn1-12/+3
* it must be initialized after the UI (Interface::main), so I added a View::initialize() function * the old initialize() method was renamed to setup() * use a global instance of QRegister::view so it is guaranteed to be destroyed only after any QRegisters that could still need it * Document API adapted to work with ViewCurrent references
2014-11-17updated GTK user interface to API changesRobin Haberkorn1-25/+73
it now works as good (or bad) as it did before. * fixed entering of the Escape character
2014-11-16first working version of the one-view-per-buffer designRobin Haberkorn1-2/+0
The user interface provides a Scintilla view abstraction and every buffer is based on a view. All Q-Register strings use a single dedicated view to save memory and initialization time when using many string registers. * this means we can finally implement a working lexer configuration and it only has to be done once when the buffer is first added to the ring. It is unnecessary to magically restore the lexer styles upon rubout of EB (very hard to implement anyway). It is also not necessary to rerun the lexer configuration macro upon rubout which would be hard to reconcile with SciTECO's basic design since every side-effect should be attached to a character. * this means that opening buffers is slightly slower now because of the view initialization * on the other hand, macros with many string q-reg operations are faster now, since the document must no longer be changed on the buffer's view and restored later on. * also now we can make a difference between editing a document in a view and changing the current view, which reduces UI calls * the Document class has been retained as an abstraction about Scintilla documents, used by QRegister Strings. It had to be made virtual, so the view on which the document is created can be specified by a virtual function. There is no additional space overhead for Documents.
2014-11-11added all of SciTECO's declarations to the "SciTECO" namespaceRobin Haberkorn1-0/+4
normally, since SciTECO is not a library, this is not strictly necessary since every library should use proper name prefixes or namespaces for all global declarations to avoid name clashes. However * you cannot always rely on that * Scintilla does violate the practice of using prefixes or namespaces. The public APIs are OK, but it does define global functions/methods, e.g. for "Document" that clashed with SciTECO's "TECODocument" class at link-time. Scintilla can put its definitions in a namespace, but this feature cannot be easily enabled without patching Scintilla. * a "SciTECO" namespace will be necessary if "SciTECO" is ever to be turned into a library. Even if this library will have only a C-linkage API, it must ensure it doesn't clutter the global namespace. So the old "TECODocument" class was renamed back to "Document" (SciTECO::Document).
2014-02-15updated Copyright to year 2014Robin Haberkorn1-1/+1
2013-03-18remove all unused-attributes for parametersRobin Haberkorn1-8/+4
* compiler does not warn by default: this actually makes sense * so we don't need any unused-attributes * less GCC-extension based * on older GCCs I think -Wunused-parameters was enabled by -Wall we should add -Wno-unused-parameters if that's the case
2013-03-18declare all global inter-dependant objects in main.cpp and get rid of ↵Robin Haberkorn1-2/+0
init_priority attribute * we cannot use weak symbols in MinGW, so we avoid init_priority for symbol initialization by compiling the empty definitions into sciteco-minimal but the real ones into sciteco (had to add new file symbols-minimal.cpp) * this fixes compilation/linking on LLVM Clang AND Dragonegg since their init_priority attribute is broken! this will likely be fixed in the near future but broken versions will be around for some time
2013-02-22resolved enter-key handling by introducing get_eol()Robin Haberkorn1-11/+1
2013-02-22function key macro support for GTK+ interfaceRobin Haberkorn1-2/+52
* also revised the way in which unhandled keys are interpreted (use gdk_keyval_to_unicode() instead of deprecated GdkEventKey::string) * keep in sync with Curses key handling
2013-02-22fixed global object initialization order issueRobin Haberkorn1-4/+7
* Scintilla is now initialized from main() using Interface::main() * Scintilla initialization depends on initialization of objects in the global namespace (otherwise the Lexer catalogue may not be filled properly and lexing may not work). Lexer modules were initialized after SciTECO interface initialization * merged Scintilla initialization (Interface::main()) with interface option parsing
2013-02-01fixed buffer Ring initializationRobin Haberkorn1-1/+1
* there was a dependency on interface initialization. it did not cause issues because destruction order was by chance. * introduced INIT_PRIO and PRIO_* macros to easy initialization order declaration (using a PRIO_* formula makes code self-documenting) * also used this to clean up QRegisterTable initialization (we do not need the explicit initialize() method) * also used to clean up symbols initialization
2013-01-23implemented special save last commandline command ("*" at beginning of ↵Robin Haberkorn1-0/+1
commandline macro) * only works as part of commandline macro, * at the beginning of other macros, it is treated like an arithmetic asterisk * variables defined in cmdline.cpp are now declared by new cmdline.h
2013-01-19updated copyright (2012-2013)Robin Haberkorn1-1/+1
2012-12-04added copyright notice to every source fileRobin Haberkorn1-0/+17
2012-12-04first working version of autotools based build-systemRobin Haberkorn1-0/+4
2012-12-04autoconf preparation: move everything into src/ subdirRobin Haberkorn1-0/+248