Mercurial > vim
comparison src/gui_kde.cc @ 39:410fa1a31baf v7.0023
updated for version 7.0023
author | vimboss |
---|---|
date | Sun, 19 Dec 2004 22:46:22 +0000 |
parents | 3f44e9abe4ec |
children | c75153d791d0 |
comparison
equal
deleted
inserted
replaced
38:c524f99c7925 | 39:410fa1a31baf |
---|---|
38 #undef dbf | 38 #undef dbf |
39 #undef db | 39 #undef db |
40 #undef mputs | 40 #undef mputs |
41 | 41 |
42 #if 1 | 42 #if 1 |
43 #define dbf( format, args... ) { printf( "%s" " : " format "\n" , __FUNCTION__ , ## args ); fflush(stdout); } | 43 #define dbf(format, args...) { printf("%s" " : " format "\n" , __FUNCTION__ , ## args ); fflush(stdout); } |
44 #define db() { printf( "%s\n", __FUNCTION__ );fflush(stdout); } | 44 #define db() { printf("%s\n", __FUNCTION__ );fflush(stdout); } |
45 #else | 45 #else |
46 #define dbf(format, args... ) | 46 #define dbf(format, args... ) |
47 #define db() | 47 #define db() |
48 #endif | 48 #endif |
49 | 49 |
163 }; | 163 }; |
164 #endif | 164 #endif |
165 /* | 165 /* |
166 * creates a blank pixmap using tb_blank | 166 * creates a blank pixmap using tb_blank |
167 */ | 167 */ |
168 QPixmap | 168 QPixmap |
169 pixmap_create_from_xpm(char **xpm)//{{{ | 169 pixmap_create_from_xpm(char **xpm)//{{{ |
170 { | 170 { |
171 return(QPixmap((const char **)xpm)); | 171 return (QPixmap((const char **)xpm)); |
172 }//}}} | 172 }//}}} |
173 | 173 |
174 /* | 174 /* |
175 * creates a pixmap by using a built-in number | 175 * creates a pixmap by using a built-in number |
176 */ | 176 */ |
177 QPixmap | 177 QPixmap |
178 pixmap_create_by_num(int pixmap_num)//{{{ | 178 pixmap_create_by_num(int pixmap_num)//{{{ |
179 { | 179 { |
180 #ifdef FEAT_KDETOOLBAR | 180 #ifdef FEAT_KDETOOLBAR |
181 if (pixmap_num >= 0 && (unsigned)pixmap_num < (sizeof(kdeicons) | 181 if (pixmap_num >= 0 && (unsigned)pixmap_num < (sizeof(kdeicons) |
182 / sizeof(kdeicons[0])) - 1) { | 182 / sizeof(kdeicons[0])) - 1) |
183 | 183 { |
184 KIconLoader *il = kapp->iconLoader(); //new KIconLoader(); | 184 |
185 QString icon; | 185 KIconLoader *il = kapp->iconLoader(); //new KIconLoader(); |
186 icon=QString(kdeicons[pixmap_num]); | 186 QString icon; |
187 return il->loadIcon(icon,KIcon::MainToolbar); | 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 | |
196 return QPixmap(); | |
197 #endif | |
198 }//}}} | |
199 | |
200 /* | |
201 * Creates a pixmap by using the pixmap "name" found in 'runtimepath'/bitmaps/ | |
202 */ | |
203 QPixmap | |
204 pixmap_create_by_dir(char_u *name)//{{{ | |
205 { | |
206 char_u full_pathname[MAXPATHL + 1]; | |
207 | |
208 if (gui_find_bitmap(name, full_pathname, "xpm") == OK) | |
209 { | |
210 return QPixmap((const char *)full_pathname); | |
211 } | |
212 else | |
213 return QPixmap(); | |
214 }//}}} | |
215 | |
216 | |
217 QPixmap | |
218 pixmap_create_from_file(char_u *file) | |
219 { | |
220 return QPixmap((const char *)file); | |
221 } | |
222 #endif | |
223 | |
224 void | |
225 gui_mch_add_menu(vimmenu_T * menu, int idx)//{{{ | |
226 { | |
227 #ifdef FEAT_MENU | |
228 QPopupMenu *me; | |
229 vimmenu_T *parent = menu->parent; | |
230 | |
231 if (menu_is_popup(menu->name)) | |
232 { | |
233 menu->widget = new QPopupMenu(vmw , (const char *)menu->name); | |
234 QObject::connect(menu->widget, SIGNAL(activated(int)), vmw, | |
235 SLOT(menu_activated(int))); | |
236 return; | |
237 } | |
238 | |
239 if (!menu_is_menubar(menu->name)) | |
240 return; | |
241 | |
242 if (parent) | |
243 { | |
244 idx++; // for tearoffs to be first in menus | |
245 me = new QPopupMenu(parent->widget, (const char *)menu->name); | |
246 parent->widget->insertItem(QString((const char *)menu->name), me, | |
247 (int)me, idx); | |
248 } | |
249 else | |
250 { | |
251 me = new QPopupMenu(vmw->menuBar() , (const char *)menu->name); | |
252 vmw->menuBar()->insertItem(QString((const char *)menu->name), me, | |
253 (int)me, idx); | |
254 } | |
255 | |
256 me->setCaption((const char *)(menu->dname)); | |
257 if (vmw->have_tearoff) | |
258 me->insertTearOffHandle(0, 0); | |
259 QObject::connect(me, SIGNAL(activated(int)), vmw, | |
260 SLOT(menu_activated(int))); | |
261 menu->widget = me; | |
262 #endif | |
263 }//}}} | |
264 | |
265 | |
266 void | |
267 gui_mch_add_menu_item(vimmenu_T * menu, int idx)//{{{ | |
268 { | |
269 #ifdef FEAT_MENU | |
270 vimmenu_T *parent = menu->parent; | |
271 #ifdef FEAT_TOOLBAR | |
272 if (menu_is_toolbar(parent->name)) | |
273 { | |
274 QPixmap pix; | |
275 | |
276 if (menu_is_separator(menu->name)) | |
277 { | |
278 vmw->toolBar()->insertSeparator(); | |
279 return; | |
188 } | 280 } |
189 return QPixmap(); | 281 if (menu->iconfile != NULL) |
190 #else | 282 { |
191 if (pixmap_num >= 0 && (unsigned)pixmap_num < (sizeof(built_in_pixmaps) | 283 pix = pixmap_create_from_file(menu->iconfile); |
192 / sizeof(built_in_pixmaps[0])) - 1) | |
193 return pixmap_create_from_xpm(built_in_pixmaps[pixmap_num]); | |
194 else return QPixmap(); | |
195 #endif | |
196 }//}}} | |
197 | |
198 /* | |
199 * Creates a pixmap by using the pixmap "name" found in 'runtimepath'/bitmaps/ | |
200 */ | |
201 QPixmap | |
202 pixmap_create_by_dir(char_u *name)//{{{ | |
203 { | |
204 char_u full_pathname[MAXPATHL + 1]; | |
205 | |
206 if (gui_find_bitmap(name, full_pathname, "xpm") == OK) { | |
207 return QPixmap((const char *)full_pathname); | |
208 } | 284 } |
209 else return QPixmap(); | 285 if (!menu->icon_builtin) |
210 }//}}} | 286 { |
211 | 287 pix = pixmap_create_by_dir(menu->name); |
212 | |
213 QPixmap | |
214 pixmap_create_from_file(char_u *file) | |
215 { | |
216 return QPixmap((const char*)file); | |
217 } | |
218 #endif | |
219 | |
220 void | |
221 gui_mch_add_menu(vimmenu_T * menu, int idx)//{{{ | |
222 { | |
223 #ifdef FEAT_MENU | |
224 QPopupMenu *me; | |
225 vimmenu_T *parent = menu->parent; | |
226 | |
227 if (menu_is_popup(menu->name)) { | |
228 menu->widget = new QPopupMenu(vmw , (const char *) menu->name); | |
229 QObject::connect( menu->widget, SIGNAL(activated(int)), vmw, SLOT(menu_activated(int)) ); | |
230 return; | |
231 } | 288 } |
232 | 289 if (pix.isNull() && menu->iconidx >= 0) |
233 if (!menu_is_menubar(menu->name)) | 290 { |
234 return; | 291 pix = pixmap_create_by_num(menu->iconidx); |
235 | |
236 if (parent) { | |
237 idx++; // for tearoffs to be first in menus | |
238 me = new QPopupMenu(parent->widget, (const char *) menu->name); | |
239 parent->widget->insertItem( QString((const char *)menu->name), me, (int)me, idx); | |
240 } else { | |
241 me = new QPopupMenu(vmw->menuBar() , (const char *) menu->name); | |
242 vmw->menuBar()->insertItem( QString((const char *)menu->name), me , (int) me, idx); | |
243 } | 292 } |
244 | 293 #ifndef FEAT_KDETOOLBAR |
245 me->setCaption((const char*)( menu->dname )); | 294 if (pix.isNull()) |
246 if (vmw->have_tearoff) me->insertTearOffHandle(0,0); | 295 { |
247 QObject::connect( me, SIGNAL(activated(int)), vmw, SLOT(menu_activated(int)) ); | 296 pix = pixmap_create_from_xpm(tb_blank_xpm); |
248 menu->widget = me; | 297 } |
249 #endif | 298 #endif |
250 }//}}} | 299 if (pix.isNull()) |
251 | 300 return; // failed |
252 | 301 vmw->toolBar()->insertButton( |
253 void | 302 pix, |
254 gui_mch_add_menu_item(vimmenu_T * menu, int idx)//{{{ | 303 (int)menu, // id |
255 { | 304 true, |
256 #ifdef FEAT_MENU | 305 (char *)(menu->strings[MENU_INDEX_TIP]), // tooltip or text |
257 vimmenu_T *parent = menu->parent; | 306 idx); |
307 menu->parent=parent; | |
308 return; | |
309 } | |
310 #endif // FEAT_TOOLBAR | |
311 | |
312 idx++; | |
313 if (menu_is_separator(menu->name)) | |
314 { | |
315 parent->widget->insertSeparator(); | |
316 return; | |
317 } | |
318 parent->widget->insertItem(QString((const char *)menu->name), (int)menu, idx); | |
319 #endif | |
320 }//}}} | |
321 | |
322 | |
323 void | |
324 gui_mch_set_text_area_pos(int x, int y, int w, int h)//{{{ | |
325 { | |
326 int X = 0; | |
327 int Y = 0; | |
328 | |
329 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | |
330 #if QT_VERSION>=300 | |
331 && !vmw->menuBar()->isTopLevelMenu() | |
332 #endif | |
333 ) | |
334 Y += vmw->menuBar()->height(); | |
258 #ifdef FEAT_TOOLBAR | 335 #ifdef FEAT_TOOLBAR |
259 if (menu_is_toolbar(parent->name)) { | 336 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
260 QPixmap pix; | 337 && vmw->toolBar()->barPos()==KToolBar::Top) |
261 if ( menu_is_separator(menu->name) ) | 338 Y += vmw->toolBar()->height(); |
262 { | 339 |
263 vmw->toolBar()->insertSeparator(); | 340 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
264 return; | 341 && vmw->toolBar()->barPos()==KToolBar::Left) |
265 } | 342 X += vmw->toolBar()->width(); |
266 if (menu->iconfile != NULL) { | 343 #endif // FEAT_TOOLBAR |
267 pix = pixmap_create_from_file(menu->iconfile); | 344 |
268 } | 345 gui.w->setGeometry(x + X, y + Y, w, h); |
269 if (!menu->icon_builtin) { | 346 }//}}} |
270 pix = pixmap_create_by_dir(menu->name); | 347 |
271 } | 348 |
272 if (pix.isNull() && menu->iconidx >= 0) { | 349 #if defined(FEAT_MENU) || defined(PROTO) |
273 pix = pixmap_create_by_num(menu->iconidx); | 350 /* |
274 } | 351 * Enable or disable mnemonics for the toplevel menus. |
275 #ifndef FEAT_KDETOOLBAR | 352 */ |
276 if (pix.isNull()) { | 353 void |
277 pix = pixmap_create_from_xpm(tb_blank_xpm); | 354 gui_gtk_set_mnemonics(int enable)//{{{ // TO BE REMOVED |
278 } | 355 { |
279 #endif | 356 }//}}} |
280 if (pix.isNull()) return; // failed | 357 |
281 vmw->toolBar()->insertButton ( | 358 void |
282 pix, | 359 toggle_tearoffs(vimmenu_T *menu, int enable)//{{{ |
283 (int) menu , // id | 360 { |
284 true, | 361 while (menu != NULL) |
285 (char *) (menu->strings[MENU_INDEX_TIP]) , // tooltip or text | 362 { |
286 idx | 363 if (!menu_is_popup(menu->name)) |
287 ); | 364 { |
288 menu->parent=parent; | 365 if (menu->widget != 0) |
289 return; | 366 { |
367 if (enable) | |
368 menu->widget->insertTearOffHandle(0,0); | |
369 else | |
370 menu->widget->removeItem(0); | |
371 } | |
372 toggle_tearoffs(menu->children, enable); | |
290 } | 373 } |
291 #endif // FEAT_TOOLBAR | 374 menu = menu->next; |
292 | 375 } |
293 idx++; | |
294 if ( menu_is_separator(menu->name) ) { | |
295 parent->widget->insertSeparator(); | |
296 return; | |
297 } | |
298 parent->widget->insertItem(QString((const char *)menu->name), (int)menu, idx ); | |
299 #endif | |
300 }//}}} | |
301 | |
302 | |
303 void | |
304 gui_mch_set_text_area_pos(int x, int y, int w, int h)//{{{ | |
305 { | |
306 int X = 0; | |
307 int Y = 0; | |
308 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | |
309 #if QT_VERSION>=300 | |
310 && !vmw->menuBar()->isTopLevelMenu() | |
311 #endif | |
312 ) | |
313 Y += vmw->menuBar()->height(); | |
314 #ifdef FEAT_TOOLBAR | |
315 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | |
316 vmw->toolBar()->barPos()==KToolBar::Top) | |
317 Y += vmw->toolBar()->height(); | |
318 | |
319 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | |
320 vmw->toolBar()->barPos()==KToolBar::Left) | |
321 X += vmw->toolBar()->width(); | |
322 #endif // FEAT_TOOLBAR | |
323 | |
324 gui.w->setGeometry(x+X,y+Y,w,h); | |
325 }//}}} | |
326 | |
327 | |
328 #if defined(FEAT_MENU) || defined(PROTO) | |
329 /* | |
330 * Enable or disable mnemonics for the toplevel menus. | |
331 */ | |
332 void | |
333 gui_gtk_set_mnemonics(int enable)//{{{ // TO BE REMOVED | |
334 { | |
335 }//}}} | |
336 | |
337 void | |
338 toggle_tearoffs(vimmenu_T *menu, int enable)//{{{ | |
339 { | |
340 while (menu != NULL) { | |
341 if (!menu_is_popup(menu->name)) { | |
342 if (menu->widget != 0) { | |
343 if (enable) menu->widget->insertTearOffHandle(0,0); | |
344 else menu->widget->removeItem(0); | |
345 } | |
346 toggle_tearoffs(menu->children, enable); | |
347 } | |
348 menu = menu->next; | |
349 } | |
350 }//}}} | 376 }//}}} |
351 | 377 |
352 void | 378 void |
353 gui_mch_toggle_tearoffs(int enable)//{{{ | 379 gui_mch_toggle_tearoffs(int enable)//{{{ |
354 { | 380 { |
360 | 386 |
361 #if defined(FEAT_MENU) || defined(PROTO) | 387 #if defined(FEAT_MENU) || defined(PROTO) |
362 /* | 388 /* |
363 * Destroy the machine specific menu widget. | 389 * Destroy the machine specific menu widget. |
364 */ | 390 */ |
365 void | 391 void |
366 gui_mch_destroy_menu(vimmenu_T * menu)//{{{ | 392 gui_mch_destroy_menu(vimmenu_T * menu)//{{{ |
367 { | 393 { |
368 #ifdef FEAT_TOOLBAR | 394 #ifdef FEAT_TOOLBAR |
369 if (menu->parent && menu_is_toolbar(menu->parent->name)) { | 395 if (menu->parent && menu_is_toolbar(menu->parent->name)) |
370 vmw->toolBar()->removeItem( (int) menu ); | 396 { |
371 return; | 397 vmw->toolBar()->removeItem((int)menu); |
372 } | 398 return; |
373 #endif | 399 } |
374 if (menu->parent) | 400 #endif |
375 menu->parent->widget->removeItem((int)menu); | 401 if (menu->parent) |
376 if (menu->widget) | 402 menu->parent->widget->removeItem((int)menu); |
377 delete menu->widget; | 403 if (menu->widget) |
378 menu->widget = 0; | 404 delete menu->widget; |
405 menu->widget = 0; | |
379 }//}}} | 406 }//}}} |
380 #endif /* FEAT_MENU */ | 407 #endif /* FEAT_MENU */ |
381 | 408 |
382 | 409 |
383 /* | 410 /* |
384 * Scrollbar stuff. | 411 * Scrollbar stuff. |
385 */ | 412 */ |
386 | 413 |
387 void | 414 void |
388 gui_mch_set_scrollbar_thumb(scrollbar_T * sb, long val, long size, long max)//{{{ | 415 gui_mch_set_scrollbar_thumb(scrollbar_T *sb, long val, long size, long max)//{{{ |
389 { | 416 { |
390 if (!sb->w) return; | 417 if (!sb->w) |
391 | 418 return; |
392 sb->w->setRange(0, max+1-size); | 419 |
393 sb->w->setValue(val); | 420 sb->w->setRange(0, max + 1 - size); |
394 | 421 sb->w->setValue(val); |
395 sb->w->setLineStep(1); | 422 |
396 sb->w->setPageStep(size); | 423 sb->w->setLineStep(1); |
397 }//}}} | 424 sb->w->setPageStep(size); |
398 | 425 }//}}} |
399 void | 426 |
400 gui_mch_set_scrollbar_pos(scrollbar_T * sb, int x, int y, int w, int h)//{{{ | 427 void |
401 { | 428 gui_mch_set_scrollbar_pos(scrollbar_T *sb, int x, int y, int w, int h)//{{{ |
402 if (!sb->w) return; | 429 { |
403 //we add the menubar and toolbar height/width | 430 if (!sb->w) |
404 int X = 0; | 431 return; |
405 int Y = 0; | 432 //we add the menubar and toolbar height/width |
406 | 433 int X = 0; |
407 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | 434 int Y = 0; |
435 | |
436 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | |
408 #if QT_VERSION>=300 | 437 #if QT_VERSION>=300 |
409 && !vmw->menuBar()->isTopLevelMenu() | 438 && !vmw->menuBar()->isTopLevelMenu() |
410 #endif | 439 #endif |
411 ) | 440 ) |
412 Y += vmw->menuBar()->height(); | 441 Y += vmw->menuBar()->height(); |
413 #ifdef FEAT_TOOLBAR | 442 #ifdef FEAT_TOOLBAR |
414 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 443 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
415 vmw->toolBar()->barPos()==KToolBar::Top) | 444 && vmw->toolBar()->barPos()==KToolBar::Top) |
416 Y += vmw->toolBar()->height(); | 445 Y += vmw->toolBar()->height(); |
417 | 446 |
418 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 447 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
419 vmw->toolBar()->barPos()==KToolBar::Left) | 448 && vmw->toolBar()->barPos()==KToolBar::Left) |
420 X += vmw->toolBar()->width(); | 449 X += vmw->toolBar()->width(); |
421 #endif //FEAT_TOOLBAR | 450 #endif //FEAT_TOOLBAR |
422 if (sb->w->orientation() == Qt::Vertical) { | 451 if (sb->w->orientation() == Qt::Vertical) |
423 bool leftscroll=gui.which_scrollbars[SBAR_LEFT]; | 452 { |
424 bool rightscroll=gui.which_scrollbars[SBAR_RIGHT]; | 453 bool leftscroll=gui.which_scrollbars[SBAR_LEFT]; |
425 if (x<20) leftscroll=true; | 454 bool rightscroll=gui.which_scrollbars[SBAR_RIGHT]; |
426 else rightscroll=true; | 455 |
427 if (x<20) sb->w->setGeometry(X,y+Y,w,h); | 456 if (x < 20) |
428 else sb->w->setGeometry(vmw->width()-w-1+X, y+Y,w,h); | 457 leftscroll = true; |
429 } else { | 458 else |
430 sb->w->setGeometry(x+X,y+Y,w,h); | 459 rightscroll = true; |
431 } | 460 if (x < 20) |
461 sb->w->setGeometry(X, y+Y, w, h); | |
462 else | |
463 sb->w->setGeometry(vmw->width() - w - 1 + X, y + Y, w, h); | |
464 } | |
465 else | |
466 { | |
467 sb->w->setGeometry(x + X, y + Y, w, h); | |
468 } | |
432 }//}}} | 469 }//}}} |
433 | 470 |
434 /* SBAR_VERT or SBAR_HORIZ */ | 471 /* SBAR_VERT or SBAR_HORIZ */ |
435 void | 472 void |
436 gui_mch_create_scrollbar(scrollbar_T * sb, int orient)//{{{ | 473 gui_mch_create_scrollbar(scrollbar_T *sb, int orient)//{{{ |
437 { | 474 { |
438 sbpool->create(sb,orient); | 475 sbpool->create(sb,orient); |
439 if (orient==SBAR_VERT) | 476 if (orient == SBAR_VERT) |
440 gui.scrollbar_width = sb->w->sizeHint().width(); | 477 gui.scrollbar_width = sb->w->sizeHint().width(); |
441 else | 478 else |
442 gui.scrollbar_height = sb->w->sizeHint().height(); | 479 gui.scrollbar_height = sb->w->sizeHint().height(); |
443 }//}}} | 480 }//}}} |
444 | 481 |
445 void | 482 void |
446 gui_mch_destroy_scrollbar(scrollbar_T * sb)//{{{ | 483 gui_mch_destroy_scrollbar(scrollbar_T * sb)//{{{ |
447 { | 484 { |
448 sbpool->destroy(sb); | 485 sbpool->destroy(sb); |
449 }//}}} | 486 }//}}} |
450 | 487 |
451 #if defined(FEAT_BROWSE) || defined(PROTO) | 488 #if defined(FEAT_BROWSE) || defined(PROTO) |
452 /* | 489 /* |
453 * Implementation of the file selector related stuff | 490 * Implementation of the file selector related stuff |
462 * ext not used (extension added) | 499 * ext not used (extension added) |
463 * initdir initial directory, NULL for current dir | 500 * initdir initial directory, NULL for current dir |
464 * filter not used (file name filter) | 501 * filter not used (file name filter) |
465 */ | 502 */ |
466 /*ARGSUSED*/ | 503 /*ARGSUSED*/ |
467 char_u * | 504 char_u * |
468 gui_mch_browse(int saving,//{{{ | 505 gui_mch_browse(int saving,//{{{ |
469 char_u * title, | 506 char_u * title, |
470 char_u * dflt, | 507 char_u * dflt, |
471 char_u * ext, | 508 char_u * ext, |
472 char_u * initdir, | 509 char_u * initdir, |
473 char_u * filter) | 510 char_u * filter) |
474 { | 511 { |
475 char * filt_glob; | 512 char *filt_glob; |
476 | 513 |
477 if (filter != (char_u *) 0x0 ) | 514 if (filter != (char_u *)0x0) |
478 { | 515 { |
479 filter = vim_strsave(filter); | 516 filter = vim_strsave(filter); |
480 strtok((char *) filter, "("); | 517 strtok((char *)filter, "("); |
481 filt_glob = strtok(0L, ")"); | 518 filt_glob = strtok(0L, ")"); |
482 } | 519 } |
483 else | 520 else |
484 filt_glob = (char *) filter; | 521 filt_glob = (char *)filter; |
485 | 522 |
486 gui_mch_mousehide(FALSE); | 523 gui_mch_mousehide(FALSE); |
487 | 524 |
488 QString s; | 525 QString s; |
489 if (!saving) | 526 if (!saving) |
490 s = KFileDialog::getOpenFileName( (char *) initdir, (char *) filt_glob, vmw, (char *) title ); | 527 s = KFileDialog::getOpenFileName((char *)initdir, (char *)filt_glob, |
491 else | 528 vmw, (char *)title); |
492 s = KFileDialog::getSaveFileName( ); | 529 else |
493 | 530 s = KFileDialog::getSaveFileName(); |
494 if (filter) | 531 |
495 vim_free(filter); | 532 if (filter) |
496 | 533 vim_free(filter); |
497 if (s.isNull()) | 534 |
498 return NULL; | 535 if (s.isNull()) |
499 QCString unistring = vmw->codec->fromUnicode(s); | 536 return NULL; |
500 char_u * s2 = (char_u *)(const char*)unistring; | 537 QCString unistring = vmw->codec->fromUnicode(s); |
501 if (s2) | 538 char_u *s2 = (char_u *)(const char *)unistring; |
502 s2 = vim_strsave( s2 ); | 539 if (s2) |
503 | 540 s2 = vim_strsave(s2); |
504 return s2; | 541 |
542 return s2; | |
505 }//}}} | 543 }//}}} |
506 | 544 |
507 #endif /* FEAT_BROWSE */ | 545 #endif /* FEAT_BROWSE */ |
508 | 546 |
509 #ifdef FEAT_GUI_DIALOG | 547 #ifdef FEAT_GUI_DIALOG |
510 | 548 |
511 /* ARGSUSED */ | 549 /* ARGSUSED */ |
512 int | 550 int |
513 gui_mch_dialog(int type, /* type of dialog *///{{{ | 551 gui_mch_dialog(int type, /* type of dialog *///{{{ |
514 char_u * title, /* title of dialog */ | 552 char_u *title, /* title of dialog */ |
515 char_u * message, /* message text */ | 553 char_u *message, /* message text */ |
516 char_u * buttons, /* names of buttons */ | 554 char_u *buttons, /* names of buttons */ |
517 int def_but, /* default button */ | 555 int def_but, /* default button */ |
518 char_u *textfield) | 556 char_u *textfield) |
519 { | 557 { |
520 gui_mch_mousehide(FALSE); | 558 gui_mch_mousehide(FALSE); |
521 VimDialog vd(type, title, message, buttons, def_but,textfield); | 559 VimDialog vd(type, title, message, buttons, def_but,textfield); |
544 #endif | 582 #endif |
545 | 583 |
546 | 584 |
547 | 585 |
548 /* Find and Replace implementations */ | 586 /* Find and Replace implementations */ |
549 void | 587 void |
550 gui_mch_find_dialog(exarg_T * eap)//{{{ | 588 gui_mch_find_dialog(exarg_T *eap)//{{{ |
551 { | 589 { |
552 // char_u* entry_text; | 590 // char_u* entry_text; |
553 //int exact_word=FALSE; | 591 //int exact_word=FALSE; |
554 // entry_text = get_find_dialog_text(eap->arg,&exact_word); | 592 // entry_text = get_find_dialog_text(eap->arg,&exact_word); |
555 | 593 |
556 vmw->finddlg->setCaseSensitive(true); | 594 vmw->finddlg->setCaseSensitive(true); |
557 | 595 |
558 /* if (entry_text!=NULL) { | 596 /* if (entry_text!=NULL) |
559 vmw->finddlg->setText(QString((char*)entry_text)); | 597 * { |
598 vmw->finddlg->setText(QString((char *)entry_text)); | |
560 // 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 | 599 // 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 |
561 }*/ // Don't use it, KDE keeps old search in memory and vim give \\Csearch, which is difficult to handle | 600 }*/ // Don't use it, KDE keeps old search in memory and vim give \\Csearch, which is difficult to handle |
562 // vim_free(entry_text); | 601 // vim_free(entry_text); |
563 | 602 |
564 vmw->finddlg->show(); | 603 vmw->finddlg->show(); |
565 }//}}} | 604 }//}}} |
566 | 605 |
567 void | 606 void |
568 gui_mch_replace_dialog(exarg_T * eap)//{{{ | 607 gui_mch_replace_dialog(exarg_T *eap)//{{{ |
569 { | 608 { |
570 // char_u* entry_text; | 609 // char_u* entry_text; |
571 //int exact_word=FALSE; | 610 //int exact_word=FALSE; |
572 | 611 |
573 // entry_text = get_find_dialog_text(eap->arg,&exact_word); | 612 // entry_text = get_find_dialog_text(eap->arg,&exact_word); |
574 | 613 |
575 /* if (entry_text!=NULL) { | 614 /* if (entry_text!=NULL) |
576 vmw->repldlg->setText(QString((char*)entry_text)); | 615 * { |
577 // 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 | 616 vmw->repldlg->setText(QString((char *)entry_text)); |
578 }*/ | 617 // 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 |
579 //vim_free(entry_text); | 618 }*/ |
580 | 619 //vim_free(entry_text); |
581 vmw->repldlg->show(); | 620 |
582 }//}}} | 621 vmw->repldlg->show(); |
583 | 622 }//}}} |
584 void | 623 |
624 void | |
585 ex_helpfind(exarg_T *eap)//{{{ | 625 ex_helpfind(exarg_T *eap)//{{{ |
586 { | 626 { |
587 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp"); | 627 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp"); |
588 }//}}} | 628 }//}}} |