]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/commands.cpp
Convert icons to RGBA, remove duplicate files, rename curve_cap icon.
[xonotic/netradiant.git] / radiant / commands.cpp
1 /*
2    Copyright (C) 2001-2006, William Joseph.
3    All Rights Reserved.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #include "commands.h"
23
24 #include "debugging/debugging.h"
25 #include "warnings.h"
26
27 #include <map>
28 #include "string/string.h"
29 #include "versionlib.h"
30 #include "gtkutil/accelerator.h"
31 #include "gtkutil/messagebox.h"
32 #include <gtk/gtktreeselection.h>
33 #include <gtk/gtkbutton.h>
34 #include "gtkmisc.h"
35
36 typedef std::pair<Accelerator, int> ShortcutValue; // accelerator, isRegistered
37 typedef std::map<CopiedString, ShortcutValue> Shortcuts;
38
39 void Shortcuts_foreach( Shortcuts& shortcuts, CommandVisitor& visitor ){
40         for ( Shortcuts::iterator i = shortcuts.begin(); i != shortcuts.end(); ++i )
41         {
42                 visitor.visit( ( *i ).first.c_str(), ( *i ).second.first );
43         }
44 }
45
46 Shortcuts g_shortcuts;
47
48 const Accelerator& GlobalShortcuts_insert( const char* name, const Accelerator& accelerator ){
49         return ( *g_shortcuts.insert( Shortcuts::value_type( name, ShortcutValue( accelerator, false ) ) ).first ).second.first;
50 }
51
52 void GlobalShortcuts_foreach( CommandVisitor& visitor ){
53         Shortcuts_foreach( g_shortcuts, visitor );
54 }
55
56 void GlobalShortcuts_register( const char* name, int type ){
57         Shortcuts::iterator i = g_shortcuts.find( name );
58         if ( i != g_shortcuts.end() ) {
59                 ( *i ).second.second = type;
60         }
61 }
62
63 void GlobalShortcuts_reportUnregistered(){
64         for ( Shortcuts::iterator i = g_shortcuts.begin(); i != g_shortcuts.end(); ++i )
65         {
66                 if ( ( *i ).second.first.key != 0 && !( *i ).second.second ) {
67                         globalOutputStream() << "shortcut not registered: " << ( *i ).first.c_str() << "\n";
68                 }
69         }
70 }
71
72 typedef std::map<CopiedString, Command> Commands;
73
74 Commands g_commands;
75
76 void GlobalCommands_insert( const char* name, const Callback& callback, const Accelerator& accelerator ){
77         bool added = g_commands.insert( Commands::value_type( name, Command( callback, GlobalShortcuts_insert( name, accelerator ) ) ) ).second;
78         ASSERT_MESSAGE( added, "command already registered: " << makeQuoted( name ) );
79 }
80
81 const Command& GlobalCommands_find( const char* command ){
82         Commands::iterator i = g_commands.find( command );
83         ASSERT_MESSAGE( i != g_commands.end(), "failed to lookup command " << makeQuoted( command ) );
84         return ( *i ).second;
85 }
86
87 typedef std::map<CopiedString, Toggle> Toggles;
88
89
90 Toggles g_toggles;
91
92 void GlobalToggles_insert( const char* name, const Callback& callback, const BoolExportCallback& exportCallback, const Accelerator& accelerator ){
93         bool added = g_toggles.insert( Toggles::value_type( name, Toggle( callback, GlobalShortcuts_insert( name, accelerator ), exportCallback ) ) ).second;
94         ASSERT_MESSAGE( added, "toggle already registered: " << makeQuoted( name ) );
95 }
96 const Toggle& GlobalToggles_find( const char* name ){
97         Toggles::iterator i = g_toggles.find( name );
98         ASSERT_MESSAGE( i != g_toggles.end(), "failed to lookup toggle " << makeQuoted( name ) );
99         return ( *i ).second;
100 }
101
102 typedef std::map<CopiedString, KeyEvent> KeyEvents;
103
104
105 KeyEvents g_keyEvents;
106
107 void GlobalKeyEvents_insert( const char* name, const Accelerator& accelerator, const Callback& keyDown, const Callback& keyUp ){
108         bool added = g_keyEvents.insert( KeyEvents::value_type( name, KeyEvent( GlobalShortcuts_insert( name, accelerator ), keyDown, keyUp ) ) ).second;
109         ASSERT_MESSAGE( added, "command already registered: " << makeQuoted( name ) );
110 }
111 const KeyEvent& GlobalKeyEvents_find( const char* name ){
112         KeyEvents::iterator i = g_keyEvents.find( name );
113         ASSERT_MESSAGE( i != g_keyEvents.end(), "failed to lookup keyEvent " << makeQuoted( name ) );
114         return ( *i ).second;
115 }
116
117
118 void disconnect_accelerator( const char *name ){
119         Shortcuts::iterator i = g_shortcuts.find( name );
120         if ( i != g_shortcuts.end() ) {
121                 switch ( ( *i ).second.second )
122                 {
123                 case 1:
124                         // command
125                         command_disconnect_accelerator( name );
126                         break;
127                 case 2:
128                         // toggle
129                         toggle_remove_accelerator( name );
130                         break;
131                 }
132         }
133 }
134
135 void connect_accelerator( const char *name ){
136         Shortcuts::iterator i = g_shortcuts.find( name );
137         if ( i != g_shortcuts.end() ) {
138                 switch ( ( *i ).second.second )
139                 {
140                 case 1:
141                         // command
142                         command_connect_accelerator( name );
143                         break;
144                 case 2:
145                         // toggle
146                         toggle_add_accelerator( name );
147                         break;
148                 }
149         }
150 }
151
152
153 #include <cctype>
154
155 #include <gtk/gtkbox.h>
156 #include <gtk/gtkliststore.h>
157 #include <gtk/gtktreemodel.h>
158 #include <gtk/gtktreeview.h>
159 #include <gtk/gtkcellrenderertext.h>
160
161 #include "gtkutil/dialog.h"
162 #include "mainframe.h"
163
164 #include "stream/textfilestream.h"
165 #include "stream/stringstream.h"
166
167
168 struct command_list_dialog_t : public ModalDialog
169 {
170         command_list_dialog_t()
171                 : m_close_button( *this, eIDCANCEL ), m_list( NULL ), m_command_iter(), m_model( NULL ), m_waiting_for_key( false ){
172         }
173         ModalDialogButton m_close_button;
174
175         GtkTreeView *m_list;
176         GtkTreeIter m_command_iter;
177         GtkTreeModel *m_model;
178         bool m_waiting_for_key;
179 };
180
181 void accelerator_clear_button_clicked( GtkButton *btn, gpointer dialogptr ){
182         command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
183
184         if ( dialog.m_waiting_for_key ) {
185                 // just unhighlight, user wanted to cancel
186                 dialog.m_waiting_for_key = false;
187                 gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 );
188                 gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true );
189                 dialog.m_model = NULL;
190                 return;
191         }
192
193         GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list );
194         GtkTreeModel *model;
195         GtkTreeIter iter;
196         if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) {
197                 return;
198         }
199
200         GValue val;
201         memset( &val, 0, sizeof( val ) );
202         gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &iter, 0, &val );
203         const char *commandName = g_value_get_string( &val );;
204
205         // clear the ACTUAL accelerator too!
206         disconnect_accelerator( commandName );
207
208         Shortcuts::iterator thisShortcutIterator = g_shortcuts.find( commandName );
209         if ( thisShortcutIterator == g_shortcuts.end() ) {
210                 return;
211         }
212         thisShortcutIterator->second.first = accelerator_null();
213
214         gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 1, "", -1 );
215
216         g_value_unset( &val );
217 }
218
219 void accelerator_edit_button_clicked( GtkButton *btn, gpointer dialogptr ){
220         command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
221
222         // 1. find selected row
223         GtkTreeSelection *sel = gtk_tree_view_get_selection( dialog.m_list );
224         GtkTreeModel *model;
225         GtkTreeIter iter;
226         if ( !gtk_tree_selection_get_selected( sel, &model, &iter ) ) {
227                 return;
228         }
229         dialog.m_command_iter = iter;
230         dialog.m_model = model;
231
232         // 2. disallow changing the row
233         //gtk_widget_set_sensitive(GTK_WIDGET(dialog.m_list), false);
234
235         // 3. highlight the row
236         gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 2, true, -1 );
237
238         // 4. grab keyboard focus
239         dialog.m_waiting_for_key = true;
240 }
241
242 gboolean accelerator_window_key_press( GtkWidget *widget, GdkEventKey *event, gpointer dialogptr ){
243         command_list_dialog_t &dialog = *(command_list_dialog_t *) dialogptr;
244
245         if ( !dialog.m_waiting_for_key ) {
246                 return false;
247         }
248
249 #if 0
250         if ( event->is_modifier ) {
251                 return false;
252         }
253 #else
254         switch ( event->keyval )
255         {
256         case GDK_Shift_L:
257         case GDK_Shift_R:
258         case GDK_Control_L:
259         case GDK_Control_R:
260         case GDK_Caps_Lock:
261         case GDK_Shift_Lock:
262         case GDK_Meta_L:
263         case GDK_Meta_R:
264         case GDK_Alt_L:
265         case GDK_Alt_R:
266         case GDK_Super_L:
267         case GDK_Super_R:
268         case GDK_Hyper_L:
269         case GDK_Hyper_R:
270                 return false;
271         }
272 #endif
273
274         dialog.m_waiting_for_key = false;
275
276         // 7. find the name of the accelerator
277         GValue val;
278         memset( &val, 0, sizeof( val ) );
279         gtk_tree_model_get_value( GTK_TREE_MODEL( dialog.m_model ), &dialog.m_command_iter, 0, &val );
280         const char *commandName = g_value_get_string( &val );;
281         Shortcuts::iterator thisShortcutIterator = g_shortcuts.find( commandName );
282         if ( thisShortcutIterator == g_shortcuts.end() ) {
283                 gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 );
284                 gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true );
285                 return true;
286         }
287
288         // 8. build an Accelerator
289         Accelerator newAccel( event->keyval, (GdkModifierType) event->state );
290
291         // 8. verify the key is still free, show a dialog to ask what to do if not
292         class VerifyAcceleratorNotTaken : public CommandVisitor
293         {
294         const char *commandName;
295         const Accelerator &newAccel;
296         GtkWidget *widget;
297         GtkTreeModel *model;
298 public:
299         bool allow;
300         VerifyAcceleratorNotTaken( const char *name, const Accelerator &accelerator, GtkWidget *w, GtkTreeModel *m ) : commandName( name ), newAccel( accelerator ), widget( w ), model( m ), allow( true ){
301         }
302         void visit( const char* name, Accelerator& accelerator ){
303                 if ( !strcmp( name, commandName ) ) {
304                         return;
305                 }
306                 if ( !allow ) {
307                         return;
308                 }
309                 if ( accelerator.key == 0 ) {
310                         return;
311                 }
312                 if ( accelerator == newAccel ) {
313                         StringOutputStream msg;
314                         msg << "The command " << name << " is already assigned to the key " << accelerator << ".\n\n"
315                                 << "Do you want to unassign " << name << " first?";
316                         EMessageBoxReturn r = gtk_MessageBox( widget, msg.c_str(), "Key already used", eMB_YESNOCANCEL );
317                         if ( r == eIDYES ) {
318                                 // clear the ACTUAL accelerator too!
319                                 disconnect_accelerator( name );
320                                 // delete the modifier
321                                 accelerator = accelerator_null();
322                                 // empty the cell of the key binds dialog
323                                 GtkTreeIter i;
324                                 if ( gtk_tree_model_get_iter_first( GTK_TREE_MODEL( model ), &i ) ) {
325                                         for (;; )
326                                         {
327                                                 GValue val;
328                                                 memset( &val, 0, sizeof( val ) );
329                                                 gtk_tree_model_get_value( GTK_TREE_MODEL( model ), &i, 0, &val );
330                                                 const char *thisName = g_value_get_string( &val );;
331                                                 if ( !strcmp( thisName, name ) ) {
332                                                         gtk_list_store_set( GTK_LIST_STORE( model ), &i, 1, "", -1 );
333                                                 }
334                                                 g_value_unset( &val );
335                                                 if ( !gtk_tree_model_iter_next( GTK_TREE_MODEL( model ), &i ) ) {
336                                                         break;
337                                                 }
338                                         }
339                                 }
340                         }
341                         else if ( r == eIDCANCEL ) {
342                                 // aborted
343                                 allow = false;
344                         }
345                 }
346         }
347         } verify_visitor( commandName, newAccel, widget, dialog.m_model );
348         GlobalShortcuts_foreach( verify_visitor );
349
350         gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 2, false, -1 );
351         gtk_widget_set_sensitive( GTK_WIDGET( dialog.m_list ), true );
352
353         if ( verify_visitor.allow ) {
354                 // clear the ACTUAL accelerator first
355                 disconnect_accelerator( commandName );
356
357                 thisShortcutIterator->second.first = newAccel;
358
359                 // write into the cell
360                 StringOutputStream modifiers;
361                 modifiers << newAccel;
362                 gtk_list_store_set( GTK_LIST_STORE( dialog.m_model ), &dialog.m_command_iter, 1, modifiers.c_str(), -1 );
363
364                 // set the ACTUAL accelerator too!
365                 connect_accelerator( commandName );
366         }
367
368         g_value_unset( &val );
369
370         dialog.m_model = NULL;
371
372         return true;
373 }
374
375 /*
376     GtkTreeIter row;
377     GValue val;
378     if(!model) {g_error("Unable to get model from cell renderer");}
379     gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(model), &row, path_string);
380
381     gtk_tree_model_get_value(GTK_TREE_MODEL(model), &row, 0, &val);
382     const char *name = g_value_get_string(&val);
383     Shortcuts::iterator i = g_shortcuts.find(name);
384     if(i != g_shortcuts.end())
385     {
386         accelerator_parse(i->second.first, new_text);
387         StringOutputStream modifiers;
388         modifiers << i->second.first;
389         gtk_list_store_set(GTK_LIST_STORE(model), &row, 1, modifiers.c_str(), -1);
390     }
391    };
392  */
393
394 void DoCommandListDlg(){
395         command_list_dialog_t dialog;
396
397         GtkWindow* window = create_modal_dialog_window( MainFrame_getWindow(), "Mapped Commands", dialog, -1, 400 );
398         g_signal_connect( G_OBJECT( window ), "key-press-event", (GCallback) accelerator_window_key_press, &dialog );
399
400         GtkAccelGroup* accel = gtk_accel_group_new();
401         gtk_window_add_accel_group( window, accel );
402
403         GtkHBox* hbox = create_dialog_hbox( 4, 4 );
404         gtk_container_add( GTK_CONTAINER( window ), GTK_WIDGET( hbox ) );
405
406         {
407                 GtkScrolledWindow* scr = create_scrolled_window( GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
408                 gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( scr ), TRUE, TRUE, 0 );
409
410                 {
411                         GtkListStore* store = gtk_list_store_new( 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INT );
412
413                         GtkWidget* view = gtk_tree_view_new_with_model( GTK_TREE_MODEL( store ) );
414                         dialog.m_list = GTK_TREE_VIEW( view );
415
416                         gtk_tree_view_set_enable_search( GTK_TREE_VIEW( view ), false ); // annoying
417
418                         {
419                                 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
420                                 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Command", renderer, "text", 0, "weight-set", 2, "weight", 3, NULL );
421                                 gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
422                         }
423
424                         {
425                                 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
426                                 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes( "Key", renderer, "text", 1, "weight-set", 2, "weight", 3, NULL );
427                                 gtk_tree_view_append_column( GTK_TREE_VIEW( view ), column );
428                         }
429
430                         gtk_widget_show( view );
431                         gtk_container_add( GTK_CONTAINER( scr ), view );
432
433                         {
434                                 // Initialize dialog
435                                 StringOutputStream path( 256 );
436                                 path << SettingsPath_get() << "commandlist.txt";
437                                 globalOutputStream() << "Writing the command list to " << path.c_str() << "\n";
438                                 class BuildCommandList : public CommandVisitor
439                                 {
440                                 TextFileOutputStream m_commandList;
441                                 GtkListStore* m_store;
442 public:
443                                 BuildCommandList( const char* filename, GtkListStore* store ) : m_commandList( filename ), m_store( store ){
444                                 }
445                                 void visit( const char* name, Accelerator& accelerator ){
446                                         StringOutputStream modifiers;
447                                         modifiers << accelerator;
448
449                                         {
450                                                 GtkTreeIter iter;
451                                                 gtk_list_store_append( m_store, &iter );
452                                                 gtk_list_store_set( m_store, &iter, 0, name, 1, modifiers.c_str(), 2, false, 3, 800, -1 );
453                                         }
454
455                                         if ( !m_commandList.failed() ) {
456                                                 int l = strlen( name );
457                                                 m_commandList << name;
458                                                 while ( l++ < 25 )
459                                                         m_commandList << ' ';
460                                                 m_commandList << modifiers.c_str() << '\n';
461                                         }
462                                 }
463                                 } visitor( path.c_str(), store );
464
465                                 GlobalShortcuts_foreach( visitor );
466                         }
467
468                         g_object_unref( G_OBJECT( store ) );
469                 }
470         }
471
472         GtkVBox* vbox = create_dialog_vbox( 4 );
473         gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( vbox ), TRUE, TRUE, 0 );
474         {
475                 GtkButton* editbutton = create_dialog_button( "Edit", (GCallback) accelerator_edit_button_clicked, &dialog );
476                 gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( editbutton ), FALSE, FALSE, 0 );
477
478                 GtkButton* clearbutton = create_dialog_button( "Clear", (GCallback) accelerator_clear_button_clicked, &dialog );
479                 gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( clearbutton ), FALSE, FALSE, 0 );
480
481                 GtkWidget *spacer = gtk_image_new();
482                 gtk_widget_show( spacer );
483                 gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( spacer ), TRUE, TRUE, 0 );
484
485                 GtkButton* button = create_modal_dialog_button( "Close", dialog.m_close_button );
486                 gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( button ), FALSE, FALSE, 0 );
487                 widget_make_default( GTK_WIDGET( button ) );
488                 gtk_widget_grab_default( GTK_WIDGET( button ) );
489                 gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Return, (GdkModifierType)0, (GtkAccelFlags)0 );
490                 gtk_widget_add_accelerator( GTK_WIDGET( button ), "clicked", accel, GDK_Escape, (GdkModifierType)0, (GtkAccelFlags)0 );
491         }
492
493         modal_dialog_show( window, dialog );
494         gtk_widget_destroy( GTK_WIDGET( window ) );
495 }
496
497 #include "profile/profile.h"
498
499 const char* const COMMANDS_VERSION = "1.0-gtk-accelnames";
500
501 void SaveCommandMap( const char* path ){
502         StringOutputStream strINI( 256 );
503         strINI << path << "shortcuts.ini";
504
505         TextFileOutputStream file( strINI.c_str() );
506         if ( !file.failed() ) {
507                 file << "[Version]\n";
508                 file << "number=" << COMMANDS_VERSION << "\n";
509                 file << "\n";
510                 file << "[Commands]\n";
511                 class WriteCommandMap : public CommandVisitor
512                 {
513                 TextFileOutputStream& m_file;
514 public:
515                 WriteCommandMap( TextFileOutputStream& file ) : m_file( file ){
516                 }
517                 void visit( const char* name, Accelerator& accelerator ){
518                         m_file << name << "=";
519
520                         const char* key = gtk_accelerator_name( accelerator.key, accelerator.modifiers );
521                         m_file << key;
522                         m_file << "\n";
523                 }
524                 } visitor( file );
525                 GlobalShortcuts_foreach( visitor );
526         }
527 }
528
529 const char* stringrange_find( const char* first, const char* last, char c ){
530         const char* p = strchr( first, '+' );
531         if ( p == 0 ) {
532                 return last;
533         }
534         return p;
535 }
536
537 class ReadCommandMap : public CommandVisitor
538 {
539 const char* m_filename;
540 std::size_t m_count;
541 public:
542 ReadCommandMap( const char* filename ) : m_filename( filename ), m_count( 0 ){
543 }
544 void visit( const char* name, Accelerator& accelerator ){
545         char value[1024];
546         if ( read_var( m_filename, "Commands", name, value ) ) {
547                 if ( string_empty( value ) ) {
548                         accelerator.key = 0;
549                         accelerator.modifiers = (GdkModifierType)0;
550                         return;
551                 }
552
553                 gtk_accelerator_parse( value, &accelerator.key, &accelerator.modifiers );
554                 accelerator = accelerator; // fix modifiers
555
556                 if ( accelerator.key != 0 ) {
557                         ++m_count;
558                 }
559                 else
560                 {
561                         globalOutputStream() << "WARNING: failed to parse user command " << makeQuoted( name ) << ": unknown key " << makeQuoted( value ) << "\n";
562                 }
563         }
564 }
565 std::size_t count() const {
566         return m_count;
567 }
568 };
569
570 void LoadCommandMap( const char* path ){
571         StringOutputStream strINI( 256 );
572         strINI << path << "shortcuts.ini";
573
574         FILE* f = fopen( strINI.c_str(), "r" );
575         if ( f != 0 ) {
576                 fclose( f );
577                 globalOutputStream() << "loading custom shortcuts list from " << makeQuoted( strINI.c_str() ) << "\n";
578
579                 Version version = version_parse( COMMANDS_VERSION );
580                 Version dataVersion = { 0, 0 };
581
582                 {
583                         char value[1024];
584                         if ( read_var( strINI.c_str(), "Version", "number", value ) ) {
585                                 dataVersion = version_parse( value );
586                         }
587                 }
588
589                 if ( version_compatible( version, dataVersion ) ) {
590                         globalOutputStream() << "commands import: data version " << dataVersion << " is compatible with code version " << version << "\n";
591                         ReadCommandMap visitor( strINI.c_str() );
592                         GlobalShortcuts_foreach( visitor );
593                         globalOutputStream() << "parsed " << Unsigned( visitor.count() ) << " custom shortcuts\n";
594                 }
595                 else
596                 {
597                         globalOutputStream() << "commands import: data version " << dataVersion << " is not compatible with code version " << version << "\n";
598                 }
599         }
600         else
601         {
602                 globalOutputStream() << "failed to load custom shortcuts from " << makeQuoted( strINI.c_str() ) << "\n";
603         }
604 }