23
|
1 /* vi:set ts=8 sts=4 sw=4:
|
11
|
2 *
|
|
3 * VIM - Vi IMproved by Bram Moolenaar
|
|
4 *
|
|
5 * Do ":help uganda" in Vim to read copying and usage conditions.
|
|
6 * Do ":help credits" in Vim to see a list of people who contributed.
|
|
7 */
|
|
8
|
|
9 /*
|
|
10 * Porting to KDE(2) was done by
|
|
11 *
|
|
12 * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
|
|
13 *
|
|
14 * Please visit http://freehackers.org/kvim for other vim- or
|
233
|
15 * kde-related coding. (URL currently doesn't work...)
|
11
|
16 *
|
|
17 * $Id$
|
|
18 *
|
|
19 */
|
|
20 #include <assert.h>
|
|
21 #include <errno.h>
|
|
22 #include <string.h>
|
|
23 #include <kmenubar.h>
|
|
24 #include <kfiledialog.h>
|
|
25 #include <kiconloader.h>
|
|
26
|
|
27 #include <qscrollbar.h>
|
|
28 #include <qcursor.h>
|
|
29 #include <qmessagebox.h>
|
|
30 #include <qiconset.h>
|
|
31 #include <qtextcodec.h>
|
20
|
32 #include "gui_kde_wid.h"
|
11
|
33
|
|
34 extern "C" {
|
|
35 #include "vim.h"
|
|
36 }
|
|
37
|
|
38 #undef dbf
|
|
39 #undef db
|
|
40 #undef mputs
|
|
41
|
|
42 #if 1
|
39
|
43 #define dbf(format, args...) { printf("%s" " : " format "\n" , __FUNCTION__ , ## args ); fflush(stdout); }
|
|
44 #define db() { printf("%s\n", __FUNCTION__ );fflush(stdout); }
|
11
|
45 #else
|
|
46 #define dbf(format, args... )
|
|
47 #define db()
|
|
48 #endif
|
|
49
|
|
50
|
|
51 #ifdef FEAT_TOOLBAR
|
|
52 #ifndef FEAT_KDETOOLBAR
|
|
53 /*
|
|
54 * Icons used by the toolbar code.
|
|
55 *///{{{
|
|
56 #include "../pixmaps/tb_new.xpm"
|
|
57 #include "../pixmaps/tb_open.xpm"
|
|
58 #include "../pixmaps/tb_close.xpm"
|
|
59 #include "../pixmaps/tb_save.xpm"
|
|
60 #include "../pixmaps/tb_print.xpm"
|
|
61 #include "../pixmaps/tb_cut.xpm"
|
|
62 #include "../pixmaps/tb_copy.xpm"
|
|
63 #include "../pixmaps/tb_paste.xpm"
|
|
64 #include "../pixmaps/tb_find.xpm"
|
|
65 #include "../pixmaps/tb_find_next.xpm"
|
|
66 #include "../pixmaps/tb_find_prev.xpm"
|
|
67 #include "../pixmaps/tb_find_help.xpm"
|
|
68 #include "../pixmaps/tb_exit.xpm"
|
|
69 #include "../pixmaps/tb_undo.xpm"
|
|
70 #include "../pixmaps/tb_redo.xpm"
|
|
71 #include "../pixmaps/tb_help.xpm"
|
|
72 #include "../pixmaps/tb_macro.xpm"
|
|
73 #include "../pixmaps/tb_make.xpm"
|
|
74 #include "../pixmaps/tb_save_all.xpm"
|
|
75 #include "../pixmaps/tb_jump.xpm"
|
|
76 #include "../pixmaps/tb_ctags.xpm"
|
|
77 #include "../pixmaps/tb_load_session.xpm"
|
|
78 #include "../pixmaps/tb_save_session.xpm"
|
|
79 #include "../pixmaps/tb_new_session.xpm"
|
|
80 #include "../pixmaps/tb_blank.xpm"
|
|
81 #include "../pixmaps/tb_maximize.xpm"
|
|
82 #include "../pixmaps/tb_split.xpm"
|
|
83 #include "../pixmaps/tb_minimize.xpm"
|
|
84 #include "../pixmaps/tb_shell.xpm"
|
|
85 #include "../pixmaps/tb_replace.xpm"
|
|
86 #include "../pixmaps/tb_vsplit.xpm"
|
|
87 #include "../pixmaps/tb_maxwidth.xpm"
|
|
88 #include "../pixmaps/tb_minwidth.xpm"
|
|
89 //}}}
|
|
90 /*
|
|
91 * These are the pixmaps used for the default buttons.
|
|
92 * Order must exactly match toolbar_names[] in menu.c!
|
|
93 *///{{{
|
|
94 static char **(built_in_pixmaps[]) =
|
|
95 {
|
|
96 tb_new_xpm,
|
|
97 tb_open_xpm,
|
|
98 tb_save_xpm,
|
|
99 tb_undo_xpm,
|
|
100 tb_redo_xpm,
|
|
101 tb_cut_xpm,
|
|
102 tb_copy_xpm,
|
|
103 tb_paste_xpm,
|
|
104 tb_print_xpm,
|
|
105 tb_help_xpm,
|
|
106 tb_find_xpm,
|
|
107 tb_save_all_xpm,
|
|
108 tb_save_session_xpm,
|
|
109 tb_new_session_xpm,
|
|
110 tb_load_session_xpm,
|
|
111 tb_macro_xpm,
|
|
112 tb_replace_xpm,
|
|
113 tb_close_xpm,
|
|
114 tb_maximize_xpm,
|
|
115 tb_minimize_xpm,
|
|
116 tb_split_xpm,
|
|
117 tb_shell_xpm,
|
|
118 tb_find_prev_xpm,
|
|
119 tb_find_next_xpm,
|
|
120 tb_find_help_xpm,
|
|
121 tb_make_xpm,
|
|
122 tb_jump_xpm,
|
|
123 tb_ctags_xpm,
|
|
124 tb_vsplit_xpm,
|
|
125 tb_maxwidth_xpm,
|
|
126 tb_minwidth_xpm,
|
|
127 tb_exit_xpm
|
|
128 };//}}}
|
|
129 #else
|
|
130 const char *kdeicons[] = {
|
|
131 "filenew",
|
|
132 "fileopen",
|
|
133 "filesave",
|
|
134 "undo",
|
|
135 "redo",
|
|
136 "editcut",
|
|
137 "editcopy",
|
|
138 "editpaste",
|
|
139 "fileprint",
|
|
140 "contents2",
|
|
141 "filefind",
|
|
142 "save_all",
|
|
143 "fileexport",
|
|
144 "filenew",
|
|
145 "fileimport",
|
|
146 "run",
|
|
147 "edit",
|
|
148 "fileclose",
|
|
149 "",
|
|
150 "",
|
|
151 "split",
|
|
152 "openterm",
|
|
153 "previous",
|
|
154 "next",
|
|
155 "help",
|
|
156 "make",
|
|
157 "goto",
|
|
158 "run",
|
|
159 "vsplit",
|
|
160 "maxwidth",
|
|
161 "minwidth",
|
|
162 "quit"
|
|
163 };
|
|
164 #endif
|
|
165 /*
|
|
166 * creates a blank pixmap using tb_blank
|
|
167 */
|
39
|
168 QPixmap
|
11
|
169 pixmap_create_from_xpm(char **xpm)//{{{
|
|
170 {
|
39
|
171 return (QPixmap((const char **)xpm));
|
11
|
172 }//}}}
|
|
173
|
|
174 /*
|
|
175 * creates a pixmap by using a built-in number
|
|
176 */
|
39
|
177 QPixmap
|
11
|
178 pixmap_create_by_num(int pixmap_num)//{{{
|
|
179 {
|
|
180 #ifdef FEAT_KDETOOLBAR
|
39
|
181 if (pixmap_num >= 0 && (unsigned)pixmap_num < (sizeof(kdeicons)
|
|
182 / sizeof(kdeicons[0])) - 1)
|
|
183 {
|
11
|
184
|
39
|
185 KIconLoader *il = kapp->iconLoader(); //new KIconLoader();
|
|
186 QString icon;
|
|
187 icon = QString(kdeicons[pixmap_num]);
|
|
188 return il->loadIcon(icon, KIcon::MainToolbar);
|
|
189 }
|
|
190 return QPixmap();
|
|
191 #else
|
|
192 if (pixmap_num >= 0 && (unsigned)pixmap_num < (sizeof(built_in_pixmaps)
|
|
193 / sizeof(built_in_pixmaps[0])) - 1)
|
|
194 return pixmap_create_from_xpm(built_in_pixmaps[pixmap_num]);
|
|
195 else
|
11
|
196 return QPixmap();
|
|
197 #endif
|
|
198 }//}}}
|
|
199
|
|
200 /*
|
|
201 * Creates a pixmap by using the pixmap "name" found in 'runtimepath'/bitmaps/
|
|
202 */
|
39
|
203 QPixmap
|
11
|
204 pixmap_create_by_dir(char_u *name)//{{{
|
|
205 {
|
39
|
206 char_u full_pathname[MAXPATHL + 1];
|
11
|
207
|
39
|
208 if (gui_find_bitmap(name, full_pathname, "xpm") == OK)
|
|
209 return QPixmap((const char *)full_pathname);
|
|
210 else
|
|
211 return QPixmap();
|
11
|
212 }//}}}
|
|
213
|
|
214
|
39
|
215 QPixmap
|
11
|
216 pixmap_create_from_file(char_u *file)
|
|
217 {
|
39
|
218 return QPixmap((const char *)file);
|
11
|
219 }
|
|
220 #endif
|
|
221
|
39
|
222 void
|
42
|
223 gui_mch_add_menu(vimmenu_T *menu, int idx)//{{{
|
11
|
224 {
|
|
225 #ifdef FEAT_MENU
|
39
|
226 QPopupMenu *me;
|
|
227 vimmenu_T *parent = menu->parent;
|
11
|
228
|
39
|
229 if (menu_is_popup(menu->name))
|
|
230 {
|
42
|
231 menu->widget = new QPopupMenu(vmw , QSTR(menu->name));
|
39
|
232 QObject::connect(menu->widget, SIGNAL(activated(int)), vmw,
|
|
233 SLOT(menu_activated(int)));
|
|
234 return;
|
|
235 }
|
11
|
236
|
39
|
237 if (!menu_is_menubar(menu->name))
|
|
238 return;
|
11
|
239
|
39
|
240 if (parent)
|
|
241 {
|
|
242 idx++; // for tearoffs to be first in menus
|
42
|
243 me = new QPopupMenu(parent->widget, QSTR(menu->name));
|
75
|
244 parent->widget->insertItem(QSTR(menu->name), me, (long)me, idx);
|
39
|
245 }
|
|
246 else
|
|
247 {
|
42
|
248 me = new QPopupMenu(vmw->menuBar(), QSTR(menu->name));
|
75
|
249 vmw->menuBar()->insertItem(QSTR(menu->name), me, (long)me, idx);
|
39
|
250 }
|
11
|
251
|
39
|
252 me->setCaption((const char *)(menu->dname));
|
|
253 if (vmw->have_tearoff)
|
|
254 me->insertTearOffHandle(0, 0);
|
|
255 QObject::connect(me, SIGNAL(activated(int)), vmw,
|
|
256 SLOT(menu_activated(int)));
|
|
257 menu->widget = me;
|
11
|
258 #endif
|
|
259 }//}}}
|
|
260
|
|
261
|
39
|
262 void
|
42
|
263 gui_mch_add_menu_item(vimmenu_T *menu, int idx)//{{{
|
11
|
264 {
|
|
265 #ifdef FEAT_MENU
|
39
|
266 vimmenu_T *parent = menu->parent;
|
11
|
267 #ifdef FEAT_TOOLBAR
|
39
|
268 if (menu_is_toolbar(parent->name))
|
|
269 {
|
|
270 QPixmap pix;
|
|
271
|
|
272 if (menu_is_separator(menu->name))
|
|
273 {
|
|
274 vmw->toolBar()->insertSeparator();
|
|
275 return;
|
|
276 }
|
|
277 if (menu->iconfile != NULL)
|
|
278 {
|
|
279 pix = pixmap_create_from_file(menu->iconfile);
|
|
280 }
|
|
281 if (!menu->icon_builtin)
|
|
282 {
|
|
283 pix = pixmap_create_by_dir(menu->name);
|
|
284 }
|
|
285 if (pix.isNull() && menu->iconidx >= 0)
|
|
286 {
|
|
287 pix = pixmap_create_by_num(menu->iconidx);
|
|
288 }
|
11
|
289 #ifndef FEAT_KDETOOLBAR
|
39
|
290 if (pix.isNull())
|
|
291 {
|
|
292 pix = pixmap_create_from_xpm(tb_blank_xpm);
|
|
293 }
|
11
|
294 #endif
|
39
|
295 if (pix.isNull())
|
|
296 return; // failed
|
|
297 vmw->toolBar()->insertButton(
|
|
298 pix,
|
75
|
299 (long)menu, // id
|
39
|
300 true,
|
42
|
301 QSTR(menu->strings[MENU_INDEX_TIP]), // tooltip or text
|
39
|
302 idx);
|
|
303 menu->parent=parent;
|
|
304 return;
|
|
305 }
|
11
|
306 #endif // FEAT_TOOLBAR
|
|
307
|
39
|
308 idx++;
|
|
309 if (menu_is_separator(menu->name))
|
|
310 {
|
|
311 parent->widget->insertSeparator();
|
|
312 return;
|
|
313 }
|
75
|
314 parent->widget->insertItem(QSTR(menu->name), (long)menu, idx);
|
11
|
315 #endif
|
|
316 }//}}}
|
|
317
|
|
318
|
39
|
319 void
|
11
|
320 gui_mch_set_text_area_pos(int x, int y, int w, int h)//{{{
|
|
321 {
|
39
|
322 int X = 0;
|
|
323 int Y = 0;
|
|
324
|
|
325 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
|
11
|
326 #if QT_VERSION>=300
|
39
|
327 && !vmw->menuBar()->isTopLevelMenu()
|
11
|
328 #endif
|
39
|
329 )
|
|
330 Y += vmw->menuBar()->height();
|
11
|
331 #ifdef FEAT_TOOLBAR
|
39
|
332 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
|
333 && vmw->toolBar()->barPos()==KToolBar::Top)
|
|
334 Y += vmw->toolBar()->height();
|
11
|
335
|
39
|
336 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
|
337 && vmw->toolBar()->barPos()==KToolBar::Left)
|
|
338 X += vmw->toolBar()->width();
|
11
|
339 #endif // FEAT_TOOLBAR
|
|
340
|
39
|
341 gui.w->setGeometry(x + X, y + Y, w, h);
|
11
|
342 }//}}}
|
|
343
|
|
344
|
|
345 #if defined(FEAT_MENU) || defined(PROTO)
|
|
346 /*
|
|
347 * Enable or disable mnemonics for the toplevel menus.
|
|
348 */
|
39
|
349 void
|
11
|
350 gui_gtk_set_mnemonics(int enable)//{{{ // TO BE REMOVED
|
|
351 {
|
|
352 }//}}}
|
|
353
|
39
|
354 void
|
11
|
355 toggle_tearoffs(vimmenu_T *menu, int enable)//{{{
|
|
356 {
|
39
|
357 while (menu != NULL)
|
|
358 {
|
|
359 if (!menu_is_popup(menu->name))
|
|
360 {
|
|
361 if (menu->widget != 0)
|
|
362 {
|
|
363 if (enable)
|
|
364 menu->widget->insertTearOffHandle(0,0);
|
|
365 else
|
|
366 menu->widget->removeItem(0);
|
|
367 }
|
|
368 toggle_tearoffs(menu->children, enable);
|
11
|
369 }
|
39
|
370 menu = menu->next;
|
|
371 }
|
11
|
372 }//}}}
|
|
373
|
|
374 void
|
|
375 gui_mch_toggle_tearoffs(int enable)//{{{
|
|
376 {
|
42
|
377 vmw->have_tearoff=enable;
|
|
378 toggle_tearoffs(root_menu, enable);
|
11
|
379 }//}}}
|
|
380 #endif
|
|
381
|
|
382
|
|
383 #if defined(FEAT_MENU) || defined(PROTO)
|
|
384 /*
|
|
385 * Destroy the machine specific menu widget.
|
|
386 */
|
39
|
387 void
|
42
|
388 gui_mch_destroy_menu(vimmenu_T *menu)//{{{
|
11
|
389 {
|
|
390 #ifdef FEAT_TOOLBAR
|
39
|
391 if (menu->parent && menu_is_toolbar(menu->parent->name))
|
|
392 {
|
75
|
393 vmw->toolBar()->removeItem((long)menu);
|
39
|
394 return;
|
|
395 }
|
11
|
396 #endif
|
39
|
397 if (menu->parent)
|
75
|
398 menu->parent->widget->removeItem((long)menu);
|
39
|
399 if (menu->widget)
|
|
400 delete menu->widget;
|
|
401 menu->widget = 0;
|
11
|
402 }//}}}
|
|
403 #endif /* FEAT_MENU */
|
|
404
|
|
405
|
|
406 /*
|
|
407 * Scrollbar stuff.
|
|
408 */
|
|
409
|
39
|
410 void
|
|
411 gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)//{{{
|
11
|
412 {
|
39
|
413 if (!sb->w)
|
|
414 return;
|
11
|
415
|
39
|
416 sb->w->setRange(0, max + 1 - size);
|
|
417 sb->w->setValue(val);
|
11
|
418
|
39
|
419 sb->w->setLineStep(1);
|
|
420 sb->w->setPageStep(size);
|
11
|
421 }//}}}
|
|
422
|
39
|
423 void
|
|
424 gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)//{{{
|
11
|
425 {
|
39
|
426 if (!sb->w)
|
|
427 return;
|
42
|
428
|
39
|
429 //we add the menubar and toolbar height/width
|
|
430 int X = 0;
|
|
431 int Y = 0;
|
11
|
432
|
39
|
433 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
|
11
|
434 #if QT_VERSION>=300
|
39
|
435 && !vmw->menuBar()->isTopLevelMenu()
|
11
|
436 #endif
|
39
|
437 )
|
|
438 Y += vmw->menuBar()->height();
|
11
|
439 #ifdef FEAT_TOOLBAR
|
39
|
440 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
|
441 && vmw->toolBar()->barPos()==KToolBar::Top)
|
|
442 Y += vmw->toolBar()->height();
|
11
|
443
|
39
|
444 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
|
|
445 && vmw->toolBar()->barPos()==KToolBar::Left)
|
|
446 X += vmw->toolBar()->width();
|
11
|
447 #endif //FEAT_TOOLBAR
|
39
|
448 if (sb->w->orientation() == Qt::Vertical)
|
|
449 {
|
|
450 bool leftscroll=gui.which_scrollbars[SBAR_LEFT];
|
|
451 bool rightscroll=gui.which_scrollbars[SBAR_RIGHT];
|
|
452
|
|
453 if (x < 20)
|
|
454 leftscroll = true;
|
|
455 else
|
|
456 rightscroll = true;
|
|
457 if (x < 20)
|
|
458 sb->w->setGeometry(X, y+Y, w, h);
|
|
459 else
|
|
460 sb->w->setGeometry(vmw->width() - w - 1 + X, y + Y, w, h);
|
|
461 }
|
|
462 else
|
|
463 {
|
|
464 sb->w->setGeometry(x + X, y + Y, w, h);
|
|
465 }
|
11
|
466 }//}}}
|
|
467
|
|
468 /* SBAR_VERT or SBAR_HORIZ */
|
39
|
469 void
|
|
470 gui_mch_create_scrollbar(scrollbar_T *sb, int orient)//{{{
|
11
|
471 {
|
39
|
472 sbpool->create(sb,orient);
|
|
473 if (orient == SBAR_VERT)
|
|
474 gui.scrollbar_width = sb->w->sizeHint().width();
|
|
475 else
|
|
476 gui.scrollbar_height = sb->w->sizeHint().height();
|
11
|
477 }//}}}
|
|
478
|
39
|
479 void
|
42
|
480 gui_mch_destroy_scrollbar(scrollbar_T *sb)//{{{
|
11
|
481 {
|
39
|
482 sbpool->destroy(sb);
|
11
|
483 }//}}}
|
|
484
|
|
485 #if defined(FEAT_BROWSE) || defined(PROTO)
|
|
486 /*
|
|
487 * Implementation of the file selector related stuff
|
|
488 */
|
|
489
|
|
490 /*
|
45
|
491 * Convert the Vim-style filter specification 's' to the KDE-style
|
|
492 * filter specification.
|
|
493 * Vim-style: {label}\t{pattern1};{pattern2}\n
|
|
494 * KDE-style: {pattern1} {pattern2}|{label}\n
|
|
495 *
|
|
496 * The newly constructed filter is returned in allocated memory and
|
|
497 * must be freed by the calling program.
|
|
498 */
|
|
499 static char *
|
|
500 convert_filter(char_u *s)
|
|
501 {
|
|
502 char *res;
|
|
503 unsigned i;
|
|
504 unsigned pattern_len;
|
|
505 char *filter_label;
|
|
506 char *filter_pattern;
|
|
507
|
|
508 // The conversion generates a string of equal length to the original
|
|
509 // pattern, so allocate enough memory to hold the original string.
|
|
510 res = new char[STRLEN(s) + 1];
|
|
511 s = vim_strsave(s);
|
|
512 if (res != NULL && s != NULL)
|
|
513 {
|
|
514 // Make sure the first byte is a NUL so that strcat()
|
|
515 // will append at the beginning of the string.
|
|
516 res[0] = '\0';
|
|
517 filter_label = strtok((char *) s, "\t");
|
|
518 while (filter_label != NULL)
|
|
519 {
|
|
520 filter_pattern = strtok( 0L, "\n");
|
|
521 if (filter_pattern != NULL)
|
|
522 {
|
|
523 pattern_len = (unsigned) STRLEN(filter_pattern);
|
|
524 for (i = 0; i < pattern_len; ++i)
|
|
525 if (filter_pattern[i] == ';')
|
|
526 filter_pattern[i] = ' ';
|
|
527
|
|
528 strcat(res, filter_pattern);
|
|
529 strcat(res, "|");
|
|
530 strcat(res, filter_label);
|
|
531 strcat(res, "\n");
|
|
532 }
|
|
533 filter_label = strtok(0L, "\t");
|
|
534 }
|
|
535 }
|
|
536 if (s)
|
|
537 vim_free(s);
|
|
538 return res;
|
|
539 }
|
|
540
|
|
541 /*
|
11
|
542 * Put up a file requester.
|
|
543 * Returns the selected name in allocated memory, or NULL for Cancel.
|
|
544 * saving, select file to write
|
|
545 * title title for the window
|
|
546 * dflt default name
|
|
547 * ext not used (extension added)
|
|
548 * initdir initial directory, NULL for current dir
|
|
549 * filter not used (file name filter)
|
|
550 */
|
|
551 /*ARGSUSED*/
|
39
|
552 char_u *
|
11
|
553 gui_mch_browse(int saving,//{{{
|
42
|
554 char_u *title,
|
|
555 char_u *dflt,
|
|
556 char_u *ext,
|
|
557 char_u *initdir,
|
|
558 char_u *filter)
|
11
|
559 {
|
39
|
560 char *filt_glob;
|
23
|
561
|
45
|
562 filt_glob = convert_filter(filter);
|
23
|
563
|
39
|
564 gui_mch_mousehide(FALSE);
|
11
|
565
|
39
|
566 QString s;
|
|
567 if (!saving)
|
42
|
568 s = KFileDialog::getOpenFileName(QSTR(initdir), QSTR(filt_glob),
|
|
569 vmw, QSTR(title));
|
39
|
570 else
|
|
571 s = KFileDialog::getSaveFileName();
|
11
|
572
|
45
|
573 if (filt_glob)
|
|
574 delete filt_glob;
|
11
|
575
|
39
|
576 if (s.isNull())
|
|
577 return NULL;
|
|
578 QCString unistring = vmw->codec->fromUnicode(s);
|
|
579 char_u *s2 = (char_u *)(const char *)unistring;
|
|
580 if (s2)
|
|
581 s2 = vim_strsave(s2);
|
|
582
|
|
583 return s2;
|
11
|
584 }//}}}
|
|
585
|
|
586 #endif /* FEAT_BROWSE */
|
|
587
|
|
588 #ifdef FEAT_GUI_DIALOG
|
|
589
|
|
590 /* ARGSUSED */
|
23
|
591 int
|
11
|
592 gui_mch_dialog(int type, /* type of dialog *///{{{
|
39
|
593 char_u *title, /* title of dialog */
|
|
594 char_u *message, /* message text */
|
|
595 char_u *buttons, /* names of buttons */
|
42
|
596 int def_but, /* default button */
|
11
|
597 char_u *textfield)
|
|
598 {
|
23
|
599 gui_mch_mousehide(FALSE);
|
|
600 VimDialog vd(type, title, message, buttons, def_but,textfield);
|
|
601 int ret = vd.exec();
|
|
602 return ret;
|
11
|
603 }//}}}
|
|
604
|
|
605
|
|
606 #endif /* FEAT_GUI_DIALOG */
|
|
607
|
|
608 #if defined(FEAT_MENU) || defined(PROTO)
|
23
|
609 void
|
42
|
610 gui_mch_show_popupmenu(vimmenu_T *menu)//{{{
|
11
|
611 {
|
23
|
612 menu->widget->popup(QCursor::pos());
|
11
|
613 }//}}}
|
|
614
|
|
615 void
|
23
|
616 gui_make_popup (char_u *pathname)//{{{
|
|
617 {
|
|
618 vimmenu_T *menu = gui_find_menu(pathname);
|
11
|
619
|
23
|
620 if (menu != NULL)
|
|
621 menu->widget->popup(QCursor::pos());
|
11
|
622 }//}}}
|
|
623 #endif
|
|
624
|
|
625
|
|
626
|
|
627 /* Find and Replace implementations */
|
39
|
628 void
|
|
629 gui_mch_find_dialog(exarg_T *eap)//{{{
|
11
|
630 {
|
23
|
631 // char_u* entry_text;
|
|
632 //int exact_word=FALSE;
|
|
633 // entry_text = get_find_dialog_text(eap->arg,&exact_word);
|
11
|
634
|
23
|
635 vmw->finddlg->setCaseSensitive(true);
|
11
|
636
|
39
|
637 /* if (entry_text!=NULL)
|
|
638 * {
|
|
639 vmw->finddlg->setText(QString((char *)entry_text));
|
23
|
640 // exact match should go there, hopefully KDE old KEdFind/KEdReplace will be replaced in KDE 4 as pple wanted KDE 3's Find/Replace to be kept
|
|
641 }*/ // Don't use it, KDE keeps old search in memory and vim give \\Csearch, which is difficult to handle
|
|
642 // vim_free(entry_text);
|
11
|
643
|
23
|
644 vmw->finddlg->show();
|
11
|
645 }//}}}
|
|
646
|
39
|
647 void
|
|
648 gui_mch_replace_dialog(exarg_T *eap)//{{{
|
11
|
649 {
|
39
|
650 // char_u* entry_text;
|
|
651 //int exact_word=FALSE;
|
11
|
652
|
39
|
653 // entry_text = get_find_dialog_text(eap->arg,&exact_word);
|
11
|
654
|
39
|
655 /* if (entry_text!=NULL)
|
|
656 * {
|
|
657 vmw->repldlg->setText(QString((char *)entry_text));
|
|
658 // exact match should go there, hopefully KDE old KEdFind/KEdReplace will be replaced in KDE 4 as pple wanted KDE 3's Find/Replace to be kept
|
|
659 }*/
|
|
660 //vim_free(entry_text);
|
11
|
661
|
39
|
662 vmw->repldlg->show();
|
11
|
663 }//}}}
|
|
664
|
39
|
665 void
|
11
|
666 ex_helpfind(exarg_T *eap)//{{{
|
|
667 {
|
39
|
668 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp");
|
11
|
669 }//}}}
|