Mercurial > vim
comparison src/gui_kde_x11.cc @ 42:c75153d791d0
updated for version 7.0026
author | vimboss |
---|---|
date | Wed, 29 Dec 2004 20:58:21 +0000 |
parents | fdf55076c53f |
children | af1bcb9a13c0 |
comparison
equal
deleted
inserted
replaced
41:f529edb9bab3 | 42:c75153d791d0 |
---|---|
56 #include <stdio.h> | 56 #include <stdio.h> |
57 | 57 |
58 /* | 58 /* |
59 * global variable for KDE, we can't put them in Gui, cause there are C++ types | 59 * global variable for KDE, we can't put them in Gui, cause there are C++ types |
60 */ | 60 */ |
61 VimMainWindow *vmw=0; | 61 VimMainWindow *vmw = 0; |
62 SBPool *sbpool=0; | 62 SBPool *sbpool = 0; |
63 QString *argServerName=0; | 63 QString *argServerName = 0; |
64 | 64 |
65 #ifdef FEAT_MOUSESHAPE | 65 #ifdef FEAT_MOUSESHAPE |
66 /* The last set mouse pointer shape is remembered, to be used when it goes | 66 /* The last set mouse pointer shape is remembered, to be used when it goes |
67 * from hidden to not hidden. */ | 67 * from hidden to not hidden. */ |
68 static int last_shape = 0; | 68 static int last_shape = 0; |
71 /* | 71 /* |
72 * Arguments handled by KDE internally. | 72 * Arguments handled by KDE internally. |
73 */ | 73 */ |
74 | 74 |
75 #if QT_VERSION>=300 | 75 #if QT_VERSION>=300 |
76 static int tip=0; // 1 no dialog, 0 use it if enabled in conf, 2 force the tip | 76 static int tip = 0; // 1 no dialog, 0 use it if enabled in conf, |
77 #endif | 77 // 2 force the tip |
78 static int reverse=0; // 0 bg : white, 1 : bg : black | 78 #endif |
79 QString *startfont; | 79 static int reverse = 0; // 0 bg : white, 1 : bg : black |
80 QSize *startsize; | 80 QString *startfont; |
81 static int gui_argc = 0; | 81 QSize *startsize; |
82 static char **gui_argv = NULL; | 82 static int gui_argc = 0; |
83 static char **gui_argv = NULL; | |
83 | 84 |
84 /* | 85 /* |
85 * Parse the GUI related command-line arguments. Any arguments used are | 86 * Parse the GUI related command-line arguments. Any arguments used are |
86 * deleted from argv, and *argc is decremented accordingly. This is called | 87 * deleted from argv, and *argc is decremented accordingly. This is called |
87 * when vim is started, whether or not the GUI has been started. | 88 * when vim is started, whether or not the GUI has been started. |
88 */ | 89 */ |
89 void | 90 void |
90 gui_mch_prepare(int *argc, char **argv)// {{{ | 91 gui_mch_prepare(int *argc, char **argv)// {{{ |
91 { | 92 { |
92 //copy args for KDE/Qt | 93 // copy args for KDE/Qt |
93 gui_argc = 0; | 94 gui_argc = 0; |
94 //this one is not really good as all options are not for KDE/Qt ... | 95 |
95 gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE); | 96 // this one is not really good as all options are not for KDE/Qt ... |
96 if (gui_argv == NULL) | 97 gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE); |
97 return; | 98 if (gui_argv == NULL) |
98 gui_argv[gui_argc++] = argv[0]; | 99 return; |
99 | 100 gui_argv[gui_argc++] = argv[0]; |
100 int found = 0; | 101 |
101 for (int i = 1; i < *argc ; i++) | 102 int found = 0; |
102 { | 103 for (int i = 1; i < *argc ; i++) |
103 if (found!=2) | 104 { |
104 found = 0; | 105 if (found != 2) |
105 else { | 106 found = 0; |
106 found=0; | 107 else |
107 //remove from the list of argv | 108 { |
108 if (--*argc>i) { | 109 found = 0; |
109 mch_memmove(&argv[i], &argv[i + 1], | 110 // remove from the list of argv |
110 (*argc - i) * sizeof(char *)); | 111 if (--*argc > i) |
111 } | 112 { |
112 i--; | 113 mch_memmove(&argv[i], &argv[i + 1], |
113 continue; | 114 (*argc - i) * sizeof(char *)); |
114 } | 115 } |
115 | 116 i--; |
116 if (strcmp(argv[i],"--servername")==0) { | 117 continue; |
117 argServerName = new QString(argv[i+1]); // to get the serverName now | 118 } |
118 } | 119 |
120 if (strcmp(argv[i], "--servername") == 0) | |
121 { | |
122 argServerName = new QString(argv[i+1]); // to get the serverName now | |
123 } | |
119 #if QT_VERSION>+300 | 124 #if QT_VERSION>+300 |
120 if (strcmp(argv[i],"-tip")==0 ) { | 125 if (strcmp(argv[i], "-tip") == 0 ) |
121 tip=2; | 126 { |
122 found=1; | 127 tip = 2; |
123 } | 128 found = 1; |
124 if (strcmp(argv[i],"-notip")==0 ) { | 129 } |
125 tip=1; | 130 if (strcmp(argv[i], "-notip") == 0 ) |
126 found=1; | 131 { |
127 } | 132 tip = 1; |
128 #endif | 133 found = 1; |
129 if (strcmp(argv[i],"-black")==0 ) { | 134 } |
130 reverse=1; | 135 #endif |
131 found=1; | 136 if (strcmp(argv[i], "-black") == 0 ) |
132 } | 137 { |
133 /* replaced by -black */ | 138 reverse = 1; |
134 /* if (strcmp(argv[i],"-rv")==0 ) { | 139 found = 1; |
135 reverse=1; | 140 } |
136 found=1; | 141 /* replaced by -black */ |
137 }*/ | 142 /* if (strcmp(argv[i], "-rv") == 0 ) |
138 if (strcmp(argv[i],"-font")==0 || strcmp(argv[i], "-fn")==0 ) { | 143 * { |
139 startfont=new QString(argv[i+1]); | 144 reverse = 1; |
140 found=2; | 145 found = 1; |
141 } | 146 }*/ |
142 if (strcmp(argv[i],"-geometry")==0 || strcmp (argv[i],"-geom")==0 ) { | 147 if (strcmp(argv[i], "-font") == 0 || strcmp(argv[i], "-fn") == 0) |
143 found=2; | 148 { |
144 QString text(argv[i+1]); | 149 startfont = new QString(argv[i+1]); |
145 QStringList list = QStringList::split(QChar('x'), text); | 150 found = 2; |
146 startsize = new QSize(list[0].toInt(),list[1].toInt()); | 151 } |
147 } | 152 if (strcmp(argv[i], "-geometry") == 0 || strcmp(argv[i], "-geom") == 0) |
148 if (strcmp (argv[i],"-display")==0 ) { //XXX: this does not work, | 153 { |
149 // too many -display options in main.c ! | 154 found = 2; |
150 // ask Bram ... | 155 QString text(argv[i + 1]); |
151 gui_argv[gui_argc++] = strdup("--display"); | 156 QStringList list = QStringList::split(QChar('x'), text); |
152 gui_argv[gui_argc++] = argv[i+1]; | 157 startsize = new QSize(list[0].toInt(), list[1].toInt()); |
153 found=0; | 158 } |
154 } | 159 if (strcmp(argv[i], "-display") == 0) //XXX: this does not work, |
155 if (strcmp (argv[i],"--display")==0 ) { | 160 // too many -display options in main.c ! |
156 gui_argv[gui_argc++] = argv[i]; | 161 // ask Bram ... |
157 gui_argv[gui_argc++] = argv[i+1]; | 162 { |
158 found=2; | 163 gui_argv[gui_argc++] = strdup("--display"); |
159 } | 164 gui_argv[gui_argc++] = argv[i+1]; |
160 //KDE/Qt options with no args | 165 found = 0; |
161 if (strcmp(argv[i],"--help-kde")==0 || strcmp (argv[i],"--help-qt")==0 | 166 } |
162 || strcmp(argv[i], "--help-all")==0 | 167 if (strcmp(argv[i], "--display") == 0 ) |
163 || strcmp(argv[i], "--reverse")==0 | 168 { |
164 || strcmp(argv[i], "--author")==0 | 169 gui_argv[gui_argc++] = argv[i]; |
165 // || strcmp(argv[i], "--version")==0 //disabled we need these for kcmvim | 170 gui_argv[gui_argc++] = argv[i+1]; |
166 // || strcmp(argv[i], "-v")==0 | 171 found = 2; |
167 || strcmp(argv[i], "--license")==0 | 172 } |
168 || strcmp(argv[i], "--cmap")==0 | 173 //KDE/Qt options with no args |
169 || strcmp(argv[i], "--nograb")==0 | 174 if (strcmp(argv[i], "--help-kde") == 0 |
170 || strcmp(argv[i], "--dograb")==0 | 175 || strcmp(argv[i], "--help-qt") == 0 |
171 || strcmp(argv[i], "--sync")==0 | 176 || strcmp(argv[i], "--help-all") == 0 |
172 || strcmp(argv[i], "--noxim")==0 | 177 || strcmp(argv[i], "--reverse") == 0 |
173 || strcmp(argv[i], "--nocrashhandler")==0 | 178 || strcmp(argv[i], "--author") == 0 |
174 || strcmp(argv[i], "--waitforwm")==0 | 179 // || strcmp(argv[i], "--version") == 0 //disabled we need these for kcmvim |
175 ) { | 180 // || strcmp(argv[i], "-v") == 0 |
176 gui_argv[gui_argc++] = argv[i]; | 181 || strcmp(argv[i], "--license") == 0 |
177 found=1; | 182 || strcmp(argv[i], "--cmap") == 0 |
178 } | 183 || strcmp(argv[i], "--nograb") == 0 |
179 //this outputs KDE and Vim versions :) | 184 || strcmp(argv[i], "--dograb") == 0 |
180 if (strcmp(argv[i],"--version")==0 | 185 || strcmp(argv[i], "--sync") == 0 |
181 || strcmp (argv[i],"-v")==0 | 186 || strcmp(argv[i], "--noxim") == 0 |
182 ) { | 187 || strcmp(argv[i], "--nocrashhandler") == 0 |
183 gui_argv[gui_argc++] = argv[i]; | 188 || strcmp(argv[i], "--waitforwm") == 0 |
184 } | 189 ) |
185 | 190 { |
186 | 191 gui_argv[gui_argc++] = argv[i]; |
187 //KDE/Qt options with one arg | 192 found = 1; |
188 if ( strcmp(argv[i],"--session")==0 | 193 } |
189 || strcmp(argv[i],"--ncols")==0 | 194 //this outputs KDE and Vim versions :) |
190 || strcmp(argv[i],"--bg")==0 | 195 if (strcmp(argv[i], "--version") == 0 |
191 || strcmp(argv[i],"--background")==0 | 196 || strcmp(argv[i], "-v") == 0) |
192 || strcmp(argv[i],"--fg")==0 | 197 { |
193 || strcmp(argv[i],"--foreground")==0 | 198 gui_argv[gui_argc++] = argv[i]; |
194 || strcmp(argv[i],"--btn")==0 | 199 } |
195 || strcmp(argv[i],"--name")==0 | 200 |
196 || strcmp(argv[i],"--title")==0 | 201 |
197 || strcmp(argv[i],"--inputstyle")==0 | 202 // KDE/Qt options with one arg |
198 || strcmp(argv[i],"--im")==0 | 203 if (strcmp(argv[i], "--session") == 0 |
199 || strcmp(argv[i],"--caption")==0 | 204 || strcmp(argv[i], "--ncols") == 0 |
200 || strcmp(argv[i],"--icon")==0 | 205 || strcmp(argv[i], "--bg") == 0 |
201 || strcmp(argv[i],"--miniicon")==0 | 206 || strcmp(argv[i], "--background") == 0 |
202 || strcmp(argv[i],"--config")==0 | 207 || strcmp(argv[i], "--fg") == 0 |
203 || strcmp(argv[i],"--dcopserver")==0 | 208 || strcmp(argv[i], "--foreground") == 0 |
204 || strcmp(argv[i],"--style")==0 | 209 || strcmp(argv[i], "--btn") == 0 |
205 || strcmp(argv[i],"--geometry")==0 | 210 || strcmp(argv[i], "--name") == 0 |
206 || strcmp(argv[i],"--smkey")==0 | 211 || strcmp(argv[i], "--title") == 0 |
207 || strcmp(argv[i],"-smkey")==0 | 212 || strcmp(argv[i], "--inputstyle") == 0 |
208 || strcmp(argv[i],"-session")==0 | 213 || strcmp(argv[i], "--im") == 0 |
209 ) { | 214 || strcmp(argv[i], "--caption") == 0 |
210 gui_argv[gui_argc++] = argv[i]; | 215 || strcmp(argv[i], "--icon") == 0 |
211 gui_argv[gui_argc++] = argv[i+1]; | 216 || strcmp(argv[i], "--miniicon") == 0 |
212 found=2; | 217 || strcmp(argv[i], "--config") == 0 |
213 } | 218 || strcmp(argv[i], "--dcopserver") == 0 |
214 | 219 || strcmp(argv[i], "--style") == 0 |
215 //remove from the list of argv | 220 || strcmp(argv[i], "--geometry") == 0 |
216 if (found >= 1 && --*argc>i) { | 221 || strcmp(argv[i], "--smkey") == 0 |
217 mch_memmove(&argv[i], &argv[i + 1], | 222 || strcmp(argv[i], "-smkey") == 0 |
218 (*argc - i) * sizeof(char *)); | 223 || strcmp(argv[i], "-session") == 0 |
219 i--; | 224 ) |
220 } | 225 { |
221 } | 226 gui_argv[gui_argc++] = argv[i]; |
222 KCmdLineArgs::init( gui_argc,gui_argv,"kvim", I18N_NOOP("Vim inside KDE"),VIM_VERSION_SHORT); | 227 gui_argv[gui_argc++] = argv[i + 1]; |
228 found = 2; | |
229 } | |
230 | |
231 // remove from the list of argv | |
232 if (found >= 1 && --*argc > i) | |
233 { | |
234 mch_memmove(&argv[i], &argv[i + 1], (*argc - i) * sizeof(char *)); | |
235 i--; | |
236 } | |
237 } | |
238 KCmdLineArgs::init(gui_argc, gui_argv, "kvim", | |
239 I18N_NOOP("Vim inside KDE"), VIM_VERSION_SHORT); | |
223 }// }}} | 240 }// }}} |
224 | 241 |
225 /**************************************************************************** | 242 /**************************************************************************** |
226 * Focus handlers: | 243 * Focus handlers: |
227 */ | 244 */ |
228 | 245 |
229 /* | 246 /* |
230 * Initialises time intervals for the cursor blinking | 247 * Initialises time intervals for the cursor blinking |
231 */ | 248 */ |
232 void | 249 void |
233 gui_mch_set_blinking(long waittime, long on, long off)//{{{ | 250 gui_mch_set_blinking(long waittime, long on, long off)//{{{ |
234 { | 251 { |
235 gui.w->set_blink_time( waittime, on, off ); | 252 gui.w->set_blink_time(waittime, on, off); |
236 }//}}} | 253 }//}}} |
237 | 254 |
238 /* | 255 /* |
239 * Stop the cursor blinking. Show the cursor if it wasn't shown. | 256 * Stop the cursor blinking. Show the cursor if it wasn't shown. |
240 */ | 257 */ |
241 void | 258 void |
242 gui_mch_stop_blink()//{{{ | 259 gui_mch_stop_blink()//{{{ |
243 { | 260 { |
244 gui.w->stop_cursor_blinking(); | 261 gui.w->stop_cursor_blinking(); |
245 }//}}} | 262 }//}}} |
246 | 263 |
247 /* | 264 /* |
248 * Start the cursor blinking. If it was already blinking, this restarts the | 265 * Start the cursor blinking. If it was already blinking, this restarts the |
249 * waiting time and shows the cursor. | 266 * waiting time and shows the cursor. |
250 */ | 267 */ |
251 void | 268 void |
252 gui_mch_start_blink()//{{{ | 269 gui_mch_start_blink()//{{{ |
253 { | 270 { |
254 gui.w->start_cursor_blinking(); | 271 gui.w->start_cursor_blinking(); |
255 }//}}} | 272 }//}}} |
256 | 273 |
257 #ifdef FEAT_MZSCHEME | 274 #ifdef FEAT_MZSCHEME |
258 void | 275 void |
259 mzscheme_kde_start_timer()//{{{ | 276 mzscheme_kde_start_timer()//{{{ |
260 { | 277 { |
261 gui.w->enable_mzscheme_threads(); | 278 gui.w->enable_mzscheme_threads(); |
262 }//}}} | 279 }//}}} |
263 void | 280 void |
264 mzscheme_kde_stop_timer()//{{{ | 281 mzscheme_kde_stop_timer()//{{{ |
265 { | 282 { |
266 gui.w->disable_mzscheme_threads(); | 283 gui.w->disable_mzscheme_threads(); |
267 }//}}} | 284 }//}}} |
268 #endif | 285 #endif |
269 | 286 |
270 /* | 287 /* |
271 * Check if the GUI can be started. Called before gvimrc is sourced. | 288 * Check if the GUI can be started. Called before gvimrc is sourced. |
272 * Return OK or FAIL. | 289 * Return OK or FAIL. |
273 */ | 290 */ |
274 int | 291 int |
275 gui_mch_init_check(void)//{{{ | 292 gui_mch_init_check(void)//{{{ |
276 { | 293 { |
277 gui.dpy = qt_xdisplay(); | 294 gui.dpy = qt_xdisplay(); |
278 return OK; | 295 return OK; |
279 }//}}} | 296 }//}}} |
280 | 297 |
281 /* | 298 /* |
282 * Initialise the X GUI. Create all the windows, set up all the call-backs etc. | 299 * Initialise the X GUI. Create all the windows, set up all the call-backs etc. |
283 * Returns OK for success, FAIL when the GUI can't be started. | 300 * Returns OK for success, FAIL when the GUI can't be started. |
284 */ | 301 */ |
285 int | 302 int |
286 gui_mch_init()//{{{ | 303 gui_mch_init()//{{{ |
287 { | 304 { |
288 (void) new KApplication(); | 305 (void) new KApplication(); |
289 KApplication::kApplication()->dcopClient()->registerAs(KApplication::kApplication()->name(),false); | 306 KApplication::kApplication()->dcopClient()->registerAs( |
290 // dbf("%s %s",KGlobal::locale()->language().latin1(),KLocale::defaultLanguage().latin1()); | 307 KApplication::kApplication()->name(), false); |
291 | 308 // dbf("%s %s", KGlobal::locale()->language().latin1(), KLocale::defaultLanguage().latin1()); |
292 vmw = new VimMainWindow("KVim",0); | 309 |
293 vmw->setFrameBorderWidth(0); | 310 vmw = new VimMainWindow("KVim", 0); |
294 kapp->setMainWidget(vmw); | 311 vmw->setFrameBorderWidth(0); |
295 kapp->setTopWidget(vmw); | 312 kapp->setMainWidget(vmw); |
296 | 313 kapp->setTopWidget(vmw); |
297 sbpool = new SBPool; | 314 |
298 | 315 sbpool = new SBPool; |
299 #if QT_VERSION>=300 | 316 |
300 vmw->connect(kapp->clipboard(),SIGNAL(selectionChanged()),vmw,SLOT(clipboard_selection_update())); | 317 #if QT_VERSION>=300 |
301 #endif | 318 vmw->connect(kapp->clipboard(), SIGNAL(selectionChanged()), |
302 vmw->connect(kapp->clipboard(),SIGNAL(dataChanged()),vmw,SLOT(clipboard_data_update())); | 319 vmw, SLOT(clipboard_selection_update())); |
303 clip_lose_selection(&clip_plus); | 320 #endif |
304 clip_lose_selection(&clip_star); | 321 vmw->connect(kapp->clipboard(), SIGNAL(dataChanged()), |
305 | 322 vmw, SLOT(clipboard_data_update())); |
306 gui.in_focus = FALSE; // will be updated | 323 clip_lose_selection(&clip_plus); |
307 | 324 clip_lose_selection(&clip_star); |
308 if (reverse) { | 325 |
309 gui.def_norm_pixel = gui_get_color((char_u *)"White"); | 326 gui.in_focus = FALSE; // will be updated |
310 gui.def_back_pixel = gui_get_color((char_u *)"Black"); | 327 |
311 #if QT_VERSION>=300 | 328 if (reverse) |
312 gui.w->setEraseColor ( QColor(Qt::black) ); | 329 { |
330 gui.def_norm_pixel = gui_get_color((char_u *)"White"); | |
331 gui.def_back_pixel = gui_get_color((char_u *)"Black"); | |
332 #if QT_VERSION>=300 | |
333 gui.w->setEraseColor(QColor(Qt::black)); | |
313 #else | 334 #else |
314 gui.w->setBackgroundColor ( QColor(Qt::black) ); | 335 gui.w->setBackgroundColor(QColor(Qt::black)); |
315 #endif | 336 #endif |
316 } else { | 337 } |
317 gui.def_norm_pixel = gui_get_color((char_u *)"Black"); | 338 else |
318 gui.def_back_pixel = gui_get_color((char_u *)"White"); | 339 { |
319 #if QT_VERSION>=300 | 340 gui.def_norm_pixel = gui_get_color((char_u *)"Black"); |
320 gui.w->setEraseColor ( QColor(Qt::white) ); | 341 gui.def_back_pixel = gui_get_color((char_u *)"White"); |
342 #if QT_VERSION>=300 | |
343 gui.w->setEraseColor(QColor(Qt::white)); | |
321 #else | 344 #else |
322 gui.w->setBackgroundColor ( QColor(Qt::white) ); | 345 gui.w->setBackgroundColor(QColor(Qt::white)); |
323 #endif | 346 #endif |
324 } | 347 } |
325 | 348 |
326 gui.norm_pixel = gui.def_norm_pixel; | 349 gui.norm_pixel = gui.def_norm_pixel; |
327 gui.back_pixel = gui.def_back_pixel; | 350 gui.back_pixel = gui.def_back_pixel; |
328 | 351 |
329 gui.border_width = 1; | 352 gui.border_width = 1; |
330 gui.border_offset = 1;//gui.border_width; | 353 gui.border_offset = 1;//gui.border_width; |
331 gui.scrollbar_width=SB_DEFAULT_WIDTH; | 354 gui.scrollbar_width = SB_DEFAULT_WIDTH; |
332 gui.scrollbar_height=SB_DEFAULT_WIDTH; | 355 gui.scrollbar_height = SB_DEFAULT_WIDTH; |
333 | 356 |
334 //gui.menu_height=vmw->menuBar()->height()+1; | 357 //gui.menu_height = vmw->menuBar()->height()+1; |
335 //gui.toolbar_height=vmw->toolBar()->height(); | 358 //gui.toolbar_height = vmw->toolBar()->height(); |
336 | 359 |
337 return OK; | 360 return OK; |
338 }//}}} | 361 }//}}} |
339 | 362 |
340 | 363 |
341 /* | 364 /* |
342 * Called when the foreground or background color has been changed. | 365 * Called when the foreground or background color has been changed. |
343 */ | 366 */ |
344 void | 367 void |
345 gui_mch_new_colors()//{{{ | 368 gui_mch_new_colors()//{{{ |
346 { | 369 { |
347 QColor rgb; | 370 QColor rgb; |
348 rgb.setRgb(gui.back_pixel); | 371 rgb.setRgb(gui.back_pixel); |
349 #if QT_VERSION>=300 | 372 #if QT_VERSION>=300 |
350 gui.w->setEraseColor(rgb); | 373 gui.w->setEraseColor(rgb); |
351 #else | 374 #else |
352 gui.w->setBackgroundColor(rgb); | 375 gui.w->setBackgroundColor(rgb); |
353 #endif | 376 #endif |
354 }//}}} | 377 }//}}} |
355 | 378 |
356 /* | 379 /* |
357 * Open the GUI window which was created by a call to gui_mch_init(). | 380 * Open the GUI window which was created by a call to gui_mch_init(). |
358 */ | 381 */ |
359 int | 382 int |
360 gui_mch_open()//{{{ | 383 gui_mch_open()//{{{ |
361 { | 384 { |
362 gui.dpy=qt_xdisplay(); | 385 gui.dpy = qt_xdisplay(); |
363 set_normal_colors(); | 386 set_normal_colors(); |
364 | 387 |
365 /* Check that none of the colors are the same as the background color */ | 388 /* Check that none of the colors are the same as the background color */ |
366 gui_check_colors(); | 389 gui_check_colors(); |
367 | 390 |
368 /* Get the colors for the highlight groups (gui_check_colors() might have | 391 /* Get the colors for the highlight groups (gui_check_colors() might have |
369 * changed them). | 392 * changed them). |
370 */ | 393 */ |
371 highlight_gui_started(); /* re-init colors and fonts */ | 394 highlight_gui_started(); /* re-init colors and fonts */ |
372 #ifdef FEAT_MENU | 395 #ifdef FEAT_MENU |
373 vmw->w->menu = new QPopupMenu(vmw); | 396 vmw->w->menu = new QPopupMenu(vmw); |
374 | 397 |
375 #if QT_VERSION>=300 | 398 #if QT_VERSION>=300 |
376 vmw->w->menu->insertItem(SmallIcon("ktip"), i18n("&Tip of the day..."), vmw, SLOT(showTipOfTheDay())); | 399 vmw->w->menu->insertItem(SmallIcon("ktip"), i18n("&Tip of the day..."), |
377 vmw->w->menu->insertSeparator(); | 400 vmw, SLOT(showTipOfTheDay())); |
378 #endif | 401 vmw->w->menu->insertSeparator(); |
379 if (vmw->have_tearoff) vmw->w->menu->insertTearOffHandle(0,0); | 402 #endif |
380 vmw->w->menu->insertItem(i18n("&Report Bug ..."), vmw, SLOT(showBugReport())); | 403 if (vmw->have_tearoff) |
381 vmw->w->menu->insertSeparator(); | 404 vmw->w->menu->insertTearOffHandle(0, 0); |
382 vmw->w->menu->insertItem(SmallIcon("kvim"), i18n("&About KVim..."), vmw, SLOT(showAboutApplication())); | 405 vmw->w->menu->insertItem(i18n("&Report Bug ..."), |
383 vmw->w->menu->insertItem(SmallIcon("about_kde"), i18n("About &KDE..."), vmw, SLOT(showAboutKDE())); | 406 vmw, SLOT(showBugReport())); |
384 vmw->menuBar()->insertItem("&KVim", vmw->w->menu); | 407 vmw->w->menu->insertSeparator(); |
385 #endif | 408 vmw->w->menu->insertItem(SmallIcon("kvim"), i18n("&About KVim..."), |
386 if (startfont!=NULL) | 409 vmw, SLOT(showAboutApplication())); |
387 gui_mch_init_font((char_u*)startfont->latin1(), FALSE); | 410 vmw->w->menu->insertItem(SmallIcon("about_kde"), i18n("About &KDE..."), |
388 | 411 vmw, SLOT(showAboutKDE())); |
389 if (startsize!=NULL) | 412 vmw->menuBar()->insertItem("&KVim", vmw->w->menu); |
390 vmw->resize(startsize->width(), startsize->height()); | 413 #endif |
391 | 414 if (startfont != NULL) |
392 gui_mch_update_codec(); | 415 gui_mch_init_font((char_u*)startfont->latin1(), FALSE); |
393 | 416 |
394 if (kapp->isRestored()) | 417 if (startsize != NULL) |
395 if (KMainWindow::canBeRestored(1)) | 418 vmw->resize(startsize->width(), startsize->height()); |
396 vmw->restore(1); | 419 |
397 | 420 gui_mch_update_codec(); |
398 vmw->show(); | 421 |
399 #if QT_VERSION>=300 | 422 if (kapp->isRestored()) |
400 if (tip==2) KTipDialog::showTip (vmw,QString::null,true); | 423 if (KMainWindow::canBeRestored(1)) |
401 else if (tip==0) KTipDialog::showTip (vmw); | 424 vmw->restore(1); |
402 #endif | 425 |
403 | 426 vmw->show(); |
404 return OK; | 427 #if QT_VERSION>=300 |
405 }//}}} | 428 if (tip == 2) |
406 | 429 KTipDialog::showTip(vmw, QString::null, true); |
407 void | 430 else if (tip == 0) |
431 KTipDialog::showTip(vmw); | |
432 #endif | |
433 | |
434 return OK; | |
435 }//}}} | |
436 | |
437 void | |
408 gui_mch_exit(int rc)//{{{ | 438 gui_mch_exit(int rc)//{{{ |
409 { | 439 { |
410 kapp->quit(); | 440 kapp->quit(); |
411 }//}}} | 441 }//}}} |
412 | 442 |
413 /* | 443 /* |
414 * Get the position of the top left corner of the window. | 444 * Get the position of the top left corner of the window. |
415 */ | 445 */ |
416 int | 446 int |
417 gui_mch_get_winpos(int *x, int *y)//{{{ | 447 gui_mch_get_winpos(int *x, int *y)//{{{ |
418 { | 448 { |
419 *x = vmw->x(); | 449 *x = vmw->x(); |
420 *y = vmw->y(); | 450 *y = vmw->y(); |
421 return OK; | 451 return OK; |
422 }//}}} | 452 }//}}} |
423 | 453 |
424 /* | 454 /* |
425 * Set the position of the top left corner of the window to the given | 455 * Set the position of the top left corner of the window to the given |
426 * coordinates. | 456 * coordinates. |
427 */ | 457 */ |
428 void | 458 void |
429 gui_mch_set_winpos(int x, int y)//{{{ | 459 gui_mch_set_winpos(int x, int y)//{{{ |
430 { | 460 { |
431 vmw->move(x,y); | 461 vmw->move(x, y); |
432 }//}}} | 462 }//}}} |
433 | 463 |
434 /* | 464 /* |
435 * Set the windows size. | 465 * Set the windows size. |
436 * ->resize VimWidget | 466 * ->resize VimWidget |
437 * ->resize vmw (block any events generated from here) | 467 * ->resize vmw (block any events generated from here) |
438 */ | 468 */ |
439 void | 469 void |
440 gui_mch_set_shellsize(int width, int height,//{{{ | 470 gui_mch_set_shellsize(int width, int height,//{{{ |
441 int min_width, int min_height, | 471 int min_width, int min_height, |
442 int base_width, int base_height) | 472 int base_width, int base_height) |
443 { | 473 { |
444 //resize VimWidget | 474 //resize VimWidget |
445 vmw->w->resize(width,height); | 475 vmw->w->resize(width, height); |
446 | 476 |
447 //resize vmw | 477 //resize vmw |
448 int vheight, vwidth; | 478 int vheight, vwidth; |
449 vheight = height; | 479 vheight = height; |
450 vwidth = width; | 480 vwidth = width; |
451 | 481 |
452 if (gui.which_scrollbars[SBAR_LEFT]) vwidth+=gui.scrollbar_width; | 482 if (gui.which_scrollbars[SBAR_LEFT]) |
453 if (gui.which_scrollbars[SBAR_RIGHT]) vwidth+=gui.scrollbar_width; | 483 vwidth += gui.scrollbar_width; |
454 if (gui.which_scrollbars[SBAR_BOTTOM]) vheight+=gui.scrollbar_height; | 484 if (gui.which_scrollbars[SBAR_RIGHT]) |
455 | 485 vwidth += gui.scrollbar_width; |
456 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | 486 if (gui.which_scrollbars[SBAR_BOTTOM]) |
457 #if QT_VERSION>=300 | 487 vheight += gui.scrollbar_height; |
458 && !vmw->menuBar()->isTopLevelMenu() | 488 |
459 #endif | 489 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() |
460 ) | 490 #if QT_VERSION>=300 |
461 vheight += vmw->menuBar()->height(); | 491 && !vmw->menuBar()->isTopLevelMenu() |
492 #endif | |
493 ) | |
494 vheight += vmw->menuBar()->height(); | |
462 #ifdef FEAT_TOOLBAR | 495 #ifdef FEAT_TOOLBAR |
463 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 496 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
464 (vmw->toolBar()->barPos()==KToolBar::Top || | 497 && (vmw->toolBar()->barPos() == KToolBar::Top |
465 vmw->toolBar()->barPos()==KToolBar::Bottom)) | 498 || vmw->toolBar()->barPos() == KToolBar::Bottom)) |
466 vheight += vmw->toolBar()->height(); | 499 vheight += vmw->toolBar()->height(); |
467 | 500 |
468 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 501 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
469 (vmw->toolBar()->barPos()==KToolBar::Left || | 502 && (vmw->toolBar()->barPos() == KToolBar::Left |
470 vmw->toolBar()->barPos()==KToolBar::Right)) | 503 || vmw->toolBar()->barPos() == KToolBar::Right)) |
471 vwidth += vmw->toolBar()->width(); | 504 vwidth += vmw->toolBar()->width(); |
472 #endif | 505 #endif |
473 vmw->lock(); | 506 vmw->lock(); |
474 vmw->resize(vwidth,vheight); | 507 vmw->resize(vwidth, vheight); |
475 gui_mch_update(); | 508 gui_mch_update(); |
476 //size should be nearly perfect, update baseSize and sizeIncrement | 509 //size should be nearly perfect, update baseSize and sizeIncrement |
477 vmw->setBaseSize(base_width,vmw->menuBar()->height()+1+vmw->toolBar()->height()+gui.char_height*2); | 510 vmw->setBaseSize(base_width, vmw->menuBar()->height() + 1 |
478 vmw->setSizeIncrement( ( ( int )( gui.char_width/2 )*2 ),gui.char_height); | 511 + vmw->toolBar()->height() + gui.char_height * 2); |
479 vmw->unlock(); | 512 vmw->setSizeIncrement((( int )(gui.char_width / 2) * 2), gui.char_height); |
513 vmw->unlock(); | |
480 }//}}} | 514 }//}}} |
481 | 515 |
482 | 516 |
483 /* | 517 /* |
484 * The screen size is used to make sure the initial window doesn't get bigger | 518 * The screen size is used to make sure the initial window doesn't get bigger |
485 * then the screen. This subtracts some room for menubar, toolbar and window | 519 * then the screen. This subtracts some room for menubar, toolbar and window |
486 * decorations. | 520 * decorations. |
487 */ | 521 */ |
488 void | 522 void |
489 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)//{{{ | 523 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)//{{{ |
490 { | 524 { |
491 *screen_w = kapp->desktop()->width(); | 525 *screen_w = kapp->desktop()->width(); |
492 *screen_h = kapp->desktop()->height(); | 526 *screen_h = kapp->desktop()->height(); |
493 }//}}} | 527 }//}}} |
494 | 528 |
495 #if defined(FEAT_MENU) || defined(PROTO) | 529 #if defined(FEAT_MENU) || defined(PROTO) |
496 void | 530 void |
497 gui_mch_enable_menu(int showit)//{{{ | 531 gui_mch_enable_menu(int showit)//{{{ |
498 { | 532 { |
499 if (showit) | 533 if (showit) |
500 vmw->menuBar()->show(); | 534 vmw->menuBar()->show(); |
501 else | 535 else |
502 vmw->menuBar()->hide(); | 536 vmw->menuBar()->hide(); |
503 vmw->resize(vmw->width(),vmw->height()); | 537 vmw->resize(vmw->width(), vmw->height()); |
504 }//}}} | 538 }//}}} |
505 #endif | 539 #endif |
506 | 540 |
507 | 541 |
508 #if defined(FEAT_TOOLBAR) || defined(PROTO) | 542 #if defined(FEAT_TOOLBAR) || defined(PROTO) |
509 void | 543 void |
510 gui_mch_show_toolbar(int showit)//{{{ | 544 gui_mch_show_toolbar(int showit)//{{{ |
511 { | 545 { |
512 if (showit) | 546 if (showit) |
513 vmw->toolBar()->show(); | 547 vmw->toolBar()->show(); |
514 else | 548 else |
515 vmw->toolBar()->hide(); | 549 vmw->toolBar()->hide(); |
516 vmw->resize(vmw->width(),vmw->height()); | 550 vmw->resize(vmw->width(), vmw->height()); |
517 }//}}} | 551 }//}}} |
518 #endif | 552 #endif |
519 | 553 |
520 /* | 554 /* |
521 * Put up a font dialog and return the selected font name in allocated memory. | 555 * Put up a font dialog and return the selected font name in allocated memory. |
522 * "oldval" is the previous value. | 556 * "oldval" is the previous value. |
523 * Return NULL when cancelled. | 557 * Return NULL when cancelled. |
524 */ | 558 */ |
525 | 559 |
526 char_u *gui_mch_font_dialog (char_u *oldval)//{{{ | 560 char_u * |
527 { | 561 gui_mch_font_dialog(char_u *oldval)//{{{ |
528 QFont myFont( vmw->w->font() ); | 562 { |
529 if (gui.fontname) { | 563 QFont myFont(vmw->w->font()); |
530 gui.fontname=NULL; | 564 if (gui.fontname) |
531 } | 565 gui.fontname = NULL; |
532 int result = KFontDialog::getFont( myFont, true ); | 566 |
533 if ( result != KFontDialog::Accepted ) { | 567 int result = KFontDialog::getFont(myFont, true); |
534 return NULL; | 568 if (result != KFontDialog::Accepted) |
535 } | 569 return NULL; |
536 // myFont.setFixedPitch(true); | 570 |
537 #if QT_VERSION>=300 | 571 // myFont.setFixedPitch(true); |
538 QString n = myFont.toString(); | 572 #if QT_VERSION>=300 |
573 QString n = myFont.toString(); | |
539 #else | 574 #else |
540 QString n = KVimUtils::toString(&myFont); | 575 QString n = KVimUtils::toString(&myFont); |
541 #endif | 576 #endif |
542 n.replace(QRegExp(","),"/"); | 577 n.replace(QRegExp(","), "/"); |
543 gui.fontname = (char_u *)strdup((const char *)n); | 578 gui.fontname = (char_u *)strdup((const char *)n); |
544 n.replace(QRegExp(" "),"\\ "); | 579 n.replace(QRegExp(" "), "\\ "); |
545 n=QString("To set this font as your default font for KVim, edit your ~/.gvimrc file and add the following lines : \nif has(\"gui_kde\")\nset guifont=")+n+QString("\nendif");// \n OR \n use the control center of KDE and choose the correct fixed font"); | 580 n = QString("To set this font as your default font for KVim, edit your ~/.gvimrc file and add the following lines : \nif has(\"gui_kde\")\nset guifont=")+n+QString("\nendif");// \n OR \n use the control center of KDE and choose the correct fixed font"); |
546 | 581 |
547 //display a message box which explains how to save your font settings | 582 //display a message box which explains how to save your font settings |
548 KMessageBox::information(vmw, n,"Font Selection", "kvimselectfont"); | 583 KMessageBox::information(vmw, n, "Font Selection", "kvimselectfont"); |
549 | 584 |
550 return vim_strsave(gui.fontname); | 585 return vim_strsave(gui.fontname); |
551 }//}}} | 586 }//}}} |
552 | 587 |
553 /* | 588 /* |
554 * Initialise vim to use the font with the given name. | 589 * Initialise vim to use the font with the given name. |
555 * Return FAIL if the font could not be loaded, OK otherwise. | 590 * Return FAIL if the font could not be loaded, OK otherwise. |
556 */ | 591 */ |
557 int | 592 int |
558 gui_mch_init_font(char_u * font_name, int fontset)//{{{ | 593 gui_mch_init_font(char_u * font_name, int fontset)//{{{ |
559 { | 594 { |
560 QString fontname; | 595 QString fontname; |
561 GuiFont font = NULL; | 596 GuiFont font = NULL; |
562 | 597 |
563 if (font_name == NULL) | 598 if (font_name == NULL) |
564 { | 599 { |
565 #if 0 | 600 #if 0 |
566 #if QT_VERSION>=300 | 601 #if QT_VERSION>=300 |
567 KConfig *base = KGlobal::config(); | 602 KConfig *base = KGlobal::config(); |
568 #else | 603 #else |
569 KConfigBase *base = KGlobal::config(); | 604 KConfigBase *base = KGlobal::config(); |
570 #endif | 605 #endif |
571 base->setGroup("General"); | 606 base->setGroup("General"); |
572 if (!base->hasKey("fixed")) { | 607 if (!base->hasKey("fixed")) |
573 KMessageBox::error(KApplication::kApplication()->mainWidget(),"Cannot load default fixed font\n\nConfigure fonts in KDE Control Center.\n(Just click 'Choose...', 'OK' and then 'Apply')"); | 608 { |
574 return FAIL; | 609 KMessageBox::error(KApplication::kApplication()->mainWidget(),"Cannot load default fixed font\n\nConfigure fonts in KDE Control Center.\n(Just click 'Choose...', 'OK' and then 'Apply')"); |
575 } | 610 return FAIL; |
576 #if QT_VERSION>=300 | 611 } |
577 QString f = base->readEntry("fixed"); | 612 #if QT_VERSION>=300 |
613 QString f = base->readEntry("fixed"); | |
578 #else | 614 #else |
579 QFont ft = base->readFontEntry("fixed", NULL); | 615 QFont ft = base->readFontEntry("fixed", NULL); |
580 QString f = KVimUtils::toString(&ft); | 616 QString f = KVimUtils::toString(&ft); |
581 #endif | 617 #endif |
582 font_name = (char_u*)strdup(f.latin1()); //latin1 ? | 618 font_name = (char_u*)strdup(f.latin1()); //latin1 ? |
583 #else | 619 #else |
584 font_name = (char_u*)strdup("misc-fixed/10/-1/5/50/0/0/0/1/0"); | 620 font_name = (char_u*)strdup("misc-fixed/10/-1/5/50/0/0/0/1/0"); |
585 #endif | 621 #endif |
586 } | 622 } |
587 fontname = (const char *)font_name; | 623 fontname = (const char *)font_name; |
588 /* fontname.replace(QRegExp("/"),","); | 624 /* fontname.replace(QRegExp("/"), ","); |
589 font = new QFont(); | 625 font = new QFont(); |
590 font->fromString( fontname ); | 626 font->fromString( fontname ); |
591 */ | 627 */ |
592 #ifdef FEAT_XFONTSET | 628 #ifdef FEAT_XFONTSET |
593 if (fontset) | 629 if (fontset) |
594 font = gui_mch_get_fontset(font_name, TRUE, TRUE); | 630 font = gui_mch_get_fontset(font_name, TRUE, TRUE); |
595 if (font == NULL) | 631 if (font == NULL) |
596 #endif | 632 #endif |
597 font = gui_mch_get_font(font_name, FALSE); | 633 font = gui_mch_get_font(font_name, FALSE); |
598 | 634 |
599 if (font == NULL) | 635 if (font == NULL) |
600 return FAIL; | 636 return FAIL; |
601 if (fontname.contains('*') && fontname.contains('-')) | 637 if (fontname.contains('*') && fontname.contains('-')) |
602 return FAIL; | 638 return FAIL; |
603 | 639 |
604 gui_mch_free_font(gui.norm_font); | 640 gui_mch_free_font(gui.norm_font); |
605 #ifdef FEAT_XFONTSET | 641 #ifdef FEAT_XFONTSET |
606 gui_mch_free_fontset(gui.fontset); | 642 gui_mch_free_fontset(gui.fontset); |
607 gui.fontset = NOFONTSET; | 643 gui.fontset = NOFONTSET; |
608 if (fontset) | 644 if (fontset) |
609 { | 645 { |
610 gui.fontset = font; | 646 gui.fontset = font; |
611 gui.norm_font = NOFONT; | 647 gui.norm_font = NOFONT; |
612 } | 648 } |
613 else | 649 else |
614 #endif | 650 #endif |
615 gui.norm_font = font; | 651 gui.norm_font = font; |
616 | 652 |
617 /* Compute the width of the character cell. Some fonts include | 653 /* Compute the width of the character cell. Some fonts include |
618 * double-width characters. Use the width of ASCII characters to find | 654 * double-width characters. Use the width of ASCII characters to find |
619 * out if this is so. */ | 655 * out if this is so. */ |
620 QFontMetrics f(*font); | 656 QFontMetrics f(*font); |
621 int width_max = 0; | 657 int width_max = 0; |
622 for (char c = 32; c < 127; c++) | 658 for (char c = 32; c < 127; c++) |
623 if (width_max < f.width((QChar)c)) | 659 if (width_max < f.width((QChar)c)) |
624 width_max = f.width((QChar)c); | 660 width_max = f.width((QChar)c); |
625 if (width_max <= f.maxWidth() / 2) | 661 if (width_max <= f.maxWidth() / 2) |
626 width_max = f.maxWidth() / 2; | 662 width_max = f.maxWidth() / 2; |
627 gui.char_width = width_max; | 663 gui.char_width = width_max; |
628 gui.char_height = f.height()+p_linespace; | 664 gui.char_height = f.height() + p_linespace; |
629 gui.char_ascent = f.ascent()+p_linespace; | 665 gui.char_ascent = f.ascent() + p_linespace; |
630 | 666 |
631 //check values, just to make sure and avoid a crash | 667 //check values, just to make sure and avoid a crash |
632 if (gui.char_width<=0) gui.char_width=8; | 668 if (gui.char_width <= 0) |
633 if (gui.char_height<=0) gui.char_height=1; | 669 gui.char_width = 8; |
634 | 670 if (gui.char_height <= 0) |
635 hl_set_font_name(font_name); | 671 gui.char_height = 1; |
636 | 672 |
637 return OK; | 673 hl_set_font_name(font_name); |
638 }//}}} | 674 |
639 | 675 vmw->w->setFont(*font); |
640 GuiFont | 676 |
677 return OK; | |
678 }//}}} | |
679 | |
680 GuiFont | |
641 gui_mch_get_font(char_u * name, int report_error)//{{{ | 681 gui_mch_get_font(char_u * name, int report_error)//{{{ |
642 { | 682 { |
643 QString fontname((const char *)name); | 683 QString fontname((const char *)name); |
644 if (!gui.in_use || name == NULL) | 684 if (!gui.in_use || name == NULL) |
645 return NOFONT; | 685 return NOFONT; |
646 if (fontname.contains('*') && fontname.contains('-')) | 686 if (fontname.contains('*') && fontname.contains('-')) |
647 return NOFONT; // XFLD names not allowed anymore | 687 return NOFONT; // XFLD names not allowed anymore |
648 QFont *myFont = new QFont(); | 688 QFont *myFont = new QFont(); |
649 fontname.replace(QRegExp("/"),","); | 689 fontname.replace(QRegExp("/"), ","); |
650 // myFont->setRawMode(TRUE); | 690 // myFont->setRawMode(TRUE); |
651 | 691 |
652 #if QT_VERSION>=300 | 692 #if QT_VERSION>=300 |
653 myFont->fromString(fontname); | 693 myFont->fromString(fontname); |
654 #else | 694 #else |
655 KVimUtils::fromString(myFont,fontname); | 695 KVimUtils::fromString(myFont, fontname); |
656 #endif | 696 #endif |
657 myFont->setFixedPitch(true); | 697 myFont->setFixedPitch(true); |
658 if (!myFont->fixedPitch()) dbf("Non fixed-width font"); | 698 if (!myFont->fixedPitch()) |
659 return (GuiFont) myFont; | 699 dbf("Non fixed-width font"); |
700 return (GuiFont) myFont; | |
660 }//}}} | 701 }//}}} |
661 | 702 |
662 /* | 703 /* |
663 * Return the name of font "font" in allocated memory. | 704 * Return the name of font "font" in allocated memory. |
664 * Don't know how to get the actual name, thus use the provided name. | 705 * Don't know how to get the actual name, thus use the provided name. |
665 */ | 706 */ |
666 char_u * | 707 char_u * |
667 gui_mch_get_fontname(font, name) | 708 gui_mch_get_fontname(GuiFont font, char_u *name)//{{{ |
668 GuiFont font; | |
669 char_u *name; | |
670 { | 709 { |
671 if (name == NULL) | 710 if (name == NULL) |
672 return NULL; | 711 return NULL; |
673 return vim_strsave(name); | 712 return vim_strsave(name); |
674 } | 713 }//}}} |
675 | 714 |
676 /* | 715 /* |
677 * Set the current text font. | 716 * Set the current text font. |
678 * Since we create all GC on demand, we use just gui.current_font to | 717 * Since we create all GC on demand, we use just gui.current_font to |
679 * indicate the desired current font. | 718 * indicate the desired current font. |
680 */ | 719 */ |
681 void | 720 void |
682 gui_mch_set_font(GuiFont font)//{{{ | 721 gui_mch_set_font(GuiFont font)//{{{ |
683 { | 722 { |
684 gui.current_font=font; | 723 gui.current_font = font; |
685 gui.w->painter->setFont( *(gui.current_font) ); | 724 gui.w->painter->setFont(*(gui.current_font)); |
686 }//}}} | 725 }//}}} |
687 | 726 |
688 /* | 727 /* |
689 * If a font is not going to be used, free its structure. | 728 * If a font is not going to be used, free its structure. |
690 */ | 729 */ |
691 void | 730 void |
692 gui_mch_free_font(GuiFont font)//{{{ | 731 gui_mch_free_font(GuiFont font)//{{{ |
693 { | 732 { |
694 if (font) | 733 if (font) |
695 delete font; // this is a QFont , we can delete it :) | 734 delete font; // this is a QFont , we can delete it :) |
696 }//}}} | 735 }//}}} |
697 | 736 |
698 GuiFontset gui_mch_get_fontset (char_u *name, int report_error, int fixed_width) | 737 GuiFontset |
699 { | 738 gui_mch_get_fontset(char_u *name, int report_error, int fixed_width) |
700 return (GuiFontset)gui_mch_get_font(name,report_error); | 739 { |
740 return (GuiFontset)gui_mch_get_font(name, report_error); | |
701 } | 741 } |
702 | 742 |
703 void gui_mch_set_fontset (GuiFontset fontset) | 743 void |
744 gui_mch_set_fontset(GuiFontset fontset) | |
704 { | 745 { |
705 gui_mch_set_font((GuiFont)fontset); | 746 gui_mch_set_font((GuiFont)fontset); |
706 } | 747 } |
707 | 748 |
708 void gui_mch_free_fontset (GuiFontset fontset) | 749 void |
750 gui_mch_free_fontset(GuiFontset fontset) | |
709 { | 751 { |
710 if (fontset) | 752 if (fontset) |
711 delete fontset; | 753 delete fontset; |
712 } | 754 } |
713 | 755 |
714 void gui_mch_settitle (char_u *title, char_u *icon)//{{{ | 756 void |
715 { | 757 gui_mch_settitle(char_u *title, char_u *icon)//{{{ |
716 if (!gui.in_use) /* can't do this when GUI not running */ | 758 { |
717 return; | 759 if (!gui.in_use) /* can't do this when GUI not running */ |
718 vmw->setPlainCaption((const char *)title); | 760 return; |
719 QPixmap p((const char *)icon); | 761 vmw->setPlainCaption((const char *)title); |
720 vmw->setIcon(p); //FIXME | 762 QPixmap p((const char *)icon); |
763 vmw->setIcon(p); //FIXME | |
721 }//}}} | 764 }//}}} |
722 | 765 |
723 /* | 766 /* |
724 * Return the Pixel value (color) for the given color name. This routine was | 767 * Return the Pixel value (color) for the given color name. This routine was |
725 * pretty much taken from example code in the Silicon Graphics OSF/Motif | 768 * pretty much taken from example code in the Silicon Graphics OSF/Motif |
726 * Programmer's Guide. | 769 * Programmer's Guide. |
727 * Return -1 for error. | 770 * Return -1 for error. |
728 */ | 771 */ |
729 guicolor_T | 772 guicolor_T |
730 gui_mch_get_color(char_u * name)//{{{ | 773 gui_mch_get_color(char_u * name)//{{{ |
731 { | 774 { |
732 int i; | 775 int i; |
733 static char *(vimnames[][2]) = | 776 static char *(vimnames[][2]) = |
734 { | 777 { |
735 /* A number of colors that some X11 systems don't have */ | 778 /* A number of colors that some X11 systems don't have */ |
736 {"LightRed", "#FFA0A0"}, | 779 {"LightRed", "#FFA0A0"}, |
737 {"LightGreen", "#80FF80"}, | 780 {"LightGreen", "#80FF80"}, |
738 {"LightMagenta", "#FFA0FF"}, | 781 {"LightMagenta", "#FFA0FF"}, |
739 {"DarkCyan", "#008080"}, | 782 {"DarkCyan", "#008080"}, |
740 {"DarkBlue", "#0000C0"}, | 783 {"DarkBlue", "#0000C0"}, |
741 {"DarkRed", "#C00000"}, | 784 {"DarkRed", "#C00000"}, |
742 {"DarkMagenta", "#C000C0"}, | 785 {"DarkMagenta", "#C000C0"}, |
743 {"DarkGrey", "#C0C0C0"}, | 786 {"DarkGrey", "#C0C0C0"}, |
744 {NULL, NULL} | 787 {NULL, NULL} |
745 }; | 788 }; |
746 | 789 |
747 if (!gui.in_use) /* can't do this when GUI not running */ | 790 if (!gui.in_use) /* can't do this when GUI not running */ |
748 return (guicolor_T)(-1); | 791 return (guicolor_T)(-1); |
749 | 792 |
750 QColor _color((const char *)name); | 793 QColor _color((const char *)name); |
751 | 794 |
752 | 795 if (_color.isValid()) |
753 if (_color.isValid()) { | 796 { |
754 //return (_color.red() << 16) + ((_color.green() << 8)) + (_color.blue()); | 797 // return (_color.red() << 16) + ((_color.green() << 8)) |
755 return _color.rgb(); | 798 // + (_color.blue()); |
756 //return (guicolor_T) _color.pixel(); | 799 return _color.rgb(); |
757 } | 800 // return (guicolor_T) _color.pixel(); |
758 | 801 } |
759 /* add a few builtin names */ | 802 |
760 for (i = 0;; ++i) { | 803 /* add a few builtin names */ |
761 if (vimnames[i][0] == NULL) | 804 for (i = 0;; ++i) |
762 return (guicolor_T)(-1); | 805 { |
763 if (STRICMP(name, vimnames[i][0]) == 0) { | 806 if (vimnames[i][0] == NULL) |
764 name = (char_u *) vimnames[i][1]; | 807 return (guicolor_T)(-1); |
765 return gui_mch_get_color(name); | 808 if (STRICMP(name, vimnames[i][0]) == 0) |
766 } | 809 { |
767 } | 810 name = (char_u *) vimnames[i][1]; |
768 | 811 return gui_mch_get_color(name); |
769 return (guicolor_T)(-1); // dead code, should not be reached.. | 812 } |
813 } | |
814 | |
815 return (guicolor_T)(-1); // dead code, should not be reached.. | |
770 }//}}} | 816 }//}}} |
771 | 817 |
772 /* | 818 /* |
773 * Set the current text foreground color. | 819 * Set the current text foreground color. |
774 */ | 820 */ |
775 void | 821 void |
776 gui_mch_set_fg_color(guicolor_T color)//{{{ | 822 gui_mch_set_fg_color(guicolor_T color)//{{{ |
777 { | 823 { |
778 QColor rgb; | 824 QColor rgb; |
779 rgb.setRgb(color); | 825 rgb.setRgb(color); |
780 gui.w->painter->setPen( rgb ); | 826 gui.w->painter->setPen(rgb); |
781 }//}}} | 827 }//}}} |
782 | 828 |
783 /* | 829 /* |
784 * Set the current text background color. | 830 * Set the current text background color. |
785 */ | 831 */ |
786 void | 832 void |
787 gui_mch_set_bg_color(guicolor_T color)//{{{ | 833 gui_mch_set_bg_color(guicolor_T color)//{{{ |
788 { | 834 { |
789 QColor rgb; | 835 QColor rgb; |
790 rgb.setRgb(color); | 836 rgb.setRgb(color); |
791 gui.w->painter->setBackgroundColor(rgb); | 837 gui.w->painter->setBackgroundColor(rgb); |
792 }//}}} | 838 }//}}} |
793 | 839 |
794 /* | 840 /* |
795 * Use the blank mouse pointer or not. | 841 * Use the blank mouse pointer or not. |
796 * | 842 * |
797 * hide: TRUE = use blank ptr, FALSE = use parent ptr | 843 * hide: TRUE = use blank ptr, FALSE = use parent ptr |
798 */ | 844 */ |
799 void | 845 void |
800 gui_mch_mousehide(int hide)//{{{ | 846 gui_mch_mousehide(int hide)//{{{ |
801 { | 847 { |
802 if (hide == gui.pointer_hidden) return; | 848 if (hide == gui.pointer_hidden) |
803 //#ifdef FEAT_MOUSESHAPE | 849 return; |
804 // if (!hide) mch_set_mouse_shape(last_shape); | 850 //#ifdef FEAT_MOUSESHAPE |
805 //#else | 851 // if (!hide) mch_set_mouse_shape(last_shape); |
852 //#else | |
806 # if (QT_VERSION<300) | 853 # if (QT_VERSION<300) |
807 gui.w->setCursor((hide)?BlankCursor:ArrowCursor); | 854 gui.w->setCursor((hide)?BlankCursor:ArrowCursor); |
808 # else | 855 # else |
809 gui.w->setCursor((hide)?Qt::BlankCursor:Qt::ArrowCursor); | 856 gui.w->setCursor((hide)?Qt::BlankCursor:Qt::ArrowCursor); |
810 # endif | 857 # endif |
811 //#endif | 858 //#endif |
812 gui.pointer_hidden = hide; | 859 gui.pointer_hidden = hide; |
813 }//}}} | 860 }//}}} |
814 | 861 |
815 void | 862 void |
816 gui_mch_update_codec() | 863 gui_mch_update_codec() |
817 { | 864 { |
818 #ifdef FEAT_MBYTE | 865 #ifdef FEAT_MBYTE |
819 if (!gui.in_use) return; | 866 if (!gui.in_use) |
820 vmw->codec = QTextCodec::codecForName((const char *)p_enc); | 867 return; |
821 if (vmw->codec==NULL) | 868 vmw->codec = QTextCodec::codecForName((const char *)p_enc); |
822 vmw->codec = QTextCodec::codecForName(KVimUtils::convertEncodingName(QString((const char*)p_enc))); | 869 if (vmw->codec == NULL) |
823 if (vmw->codec==NULL) | 870 vmw->codec = QTextCodec::codecForName( |
824 vmw->codec = QTextCodec::codecForLocale(); | 871 KVimUtils::convertEncodingName(QString((const char*)p_enc))); |
872 if (vmw->codec == NULL) | |
873 vmw->codec = QTextCodec::codecForLocale(); | |
825 #else | 874 #else |
826 vmw->codec = QTextCodec::codecForLocale(); | 875 vmw->codec = QTextCodec::codecForLocale(); |
827 #endif | 876 #endif |
828 if (vmw->codec==NULL) | 877 if (vmw->codec == NULL) |
829 vmw->codec = QTextCodec::codecForName("ISO-8859-1"); //fallback | 878 vmw->codec = QTextCodec::codecForName("ISO-8859-1"); //fallback |
830 } | 879 } |
831 | 880 |
832 void | 881 void |
833 gui_mch_draw_string(int row, int col, char_u * s, int len, int flags)//{{{ | 882 gui_mch_draw_string(int row, int col, char_u * s, int len, int flags)//{{{ |
834 { | 883 { |
835 QString text = vmw->codec->toUnicode((const char *)s,len); | 884 QString text = vmw->codec->toUnicode((const char *)s, len); |
836 gui.w->draw_string( TEXT_X(col), TEXT_Y(row), text, text.length(), flags ); | 885 gui.w->draw_string(TEXT_X(col), TEXT_Y(row), text, text.length(), flags); |
837 }//}}} | 886 }//}}} |
838 | 887 |
839 #if defined(FEAT_TITLE) || defined(PROTO) | 888 #if defined(FEAT_TITLE) || defined(PROTO) |
840 /* | 889 /* |
841 * Return the text window-id and display. Only required for X-based GUI's | 890 * Return the text window-id and display. Only required for X-based GUI's |
842 */ | 891 */ |
843 int | 892 int |
844 gui_get_x11_windis(Window * win, Display ** dis)//{{{ | 893 gui_get_x11_windis(Window * win, Display ** dis)//{{{ |
845 { | 894 { |
846 *win = /*vmw*/gui.w->winId(); | 895 *win = /*vmw*/gui.w->winId(); |
847 *dis = qt_xdisplay(); | 896 *dis = qt_xdisplay(); |
848 return OK; | 897 return OK; |
849 }//}}} | 898 }//}}} |
850 #endif | 899 #endif |
851 | 900 |
852 void | 901 void |
853 gui_mch_beep()//{{{ | 902 gui_mch_beep()//{{{ |
854 { | 903 { |
855 kapp->beep(); | 904 kapp->beep(); |
856 }//}}} | 905 }//}}} |
857 | 906 |
858 void | 907 void |
859 gui_mch_flash(int msec)//{{{ | 908 gui_mch_flash(int msec)//{{{ |
860 { | 909 { |
861 gui.w->flash(); | 910 gui.w->flash(); |
862 }//}}} | 911 }//}}} |
863 | 912 |
864 /* | 913 /* |
865 * Invert a rectangle from row r, column c, for nr rows and nc columns. | 914 * Invert a rectangle from row r, column c, for nr rows and nc columns. |
866 */ | 915 */ |
867 void | 916 void |
868 gui_mch_invert_rectangle(int r, int c, int nr, int nc)//{{{ | 917 gui_mch_invert_rectangle(int r, int c, int nr, int nc)//{{{ |
869 { | 918 { |
870 bitBlt ( | 919 bitBlt(gui.w, |
871 gui.w, | 920 FILL_X(c), FILL_Y(r), |
872 FILL_X(c), FILL_Y(r), | 921 gui.w, |
873 gui.w, | 922 FILL_X(c), FILL_Y(r), |
874 FILL_X(c), FILL_Y(r), | 923 (nc) * gui.char_width, |
875 (nc) * gui.char_width, | 924 (nr) * gui.char_height, |
876 (nr) * gui.char_height, | 925 Qt::NotROP, // raster Operation |
877 Qt::NotROP, // raster Operation | 926 true); // ignoreMask |
878 true ); // ignoreMask | |
879 }//}}} | 927 }//}}} |
880 | 928 |
881 /* | 929 /* |
882 * Iconify the GUI window. | 930 * Iconify the GUI window. |
883 */ | 931 */ |
884 void | 932 void |
885 gui_mch_iconify()//{{{ | 933 gui_mch_iconify()//{{{ |
886 { | 934 { |
887 vmw->showMinimized(); | 935 vmw->showMinimized(); |
888 }//}}} | 936 }//}}} |
889 | 937 |
890 /* | 938 /* |
891 * Draw a cursor without focus. | 939 * Draw a cursor without focus. |
892 */ | 940 */ |
893 void | 941 void |
894 gui_mch_draw_hollow_cursor(guicolor_T color)//{{{ | 942 gui_mch_draw_hollow_cursor(guicolor_T color)//{{{ |
895 { | 943 { |
896 QPainter p(gui.w); | 944 QPainter p(gui.w); |
897 p.setPen( color ); | 945 p.setPen(color); |
898 | 946 |
899 p.drawRect(FILL_X(gui.col), FILL_Y(gui.row), gui.char_width - 1, gui.char_height - 1 ); | 947 p.drawRect(FILL_X(gui.col), FILL_Y(gui.row), gui.char_width - 1, |
900 | 948 gui.char_height - 1); |
901 p.end(); | 949 p.end(); |
902 }//}}} | 950 }//}}} |
903 | 951 |
904 /* | 952 /* |
905 * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using | 953 * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using |
906 * color "color". | 954 * color "color". |
907 */ | 955 */ |
908 void | 956 void |
909 gui_mch_draw_part_cursor(int w, int h, guicolor_T color)//{{{ | 957 gui_mch_draw_part_cursor(int w, int h, guicolor_T color)//{{{ |
910 { | 958 { |
911 QPainter p(gui.w); | 959 QPainter p(gui.w); |
912 p.setPen( color ); | 960 p.setPen(color); |
913 p.fillRect( | 961 p.fillRect( |
914 FILL_X(gui.col), | 962 FILL_X(gui.col), |
915 FILL_Y(gui.row) + gui.char_height - h +1, | 963 FILL_Y(gui.row) + gui.char_height - h + 1, |
916 w, h-2, QColor( color, color)); | 964 w, h - 2, QColor( color, color)); |
917 p.drawRect(FILL_X(gui.col),FILL_Y(gui.row) + gui.char_height - h + (int)p_linespace / 2, | 965 p.drawRect(FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h |
918 w, h - (int)p_linespace ); | 966 + (int)p_linespace / 2, |
919 | 967 w, h - (int)p_linespace); |
920 }//}}} | 968 }//}}} |
921 | 969 |
922 | 970 |
923 /* | 971 /* |
924 * Catch up with any queued X11 events. This may put keyboard input into the | 972 * Catch up with any queued X11 events. This may put keyboard input into the |
925 * input buffer, call resize call-backs, trigger timers etc. If there is | 973 * input buffer, call resize call-backs, trigger timers etc. If there is |
926 * nothing in the X11 event queue (& no timers pending), then we return | 974 * nothing in the X11 event queue (& no timers pending), then we return |
927 * immediately. | 975 * immediately. |
928 */ | 976 */ |
929 void | 977 void |
930 gui_mch_update()//{{{ | 978 gui_mch_update()//{{{ |
931 { | 979 { |
932 kapp->processEvents(); | 980 kapp->processEvents(); |
933 }//}}} | 981 }//}}} |
934 | 982 |
935 | 983 |
936 /* | 984 /* |
937 * GUI input routine called by gui_wait_for_chars(). Waits for a character | 985 * GUI input routine called by gui_wait_for_chars(). Waits for a character |
940 * wtime == 0 This should never happen. | 988 * wtime == 0 This should never happen. |
941 * wtime > 0 Wait wtime milliseconds for a character. | 989 * wtime > 0 Wait wtime milliseconds for a character. |
942 * Returns OK if a character was found to be available within the given time, | 990 * Returns OK if a character was found to be available within the given time, |
943 * or FAIL otherwise. | 991 * or FAIL otherwise. |
944 */ | 992 */ |
945 int | 993 int |
946 gui_mch_wait_for_chars(long wtime)//{{{ | 994 gui_mch_wait_for_chars(long wtime)//{{{ |
947 { | 995 { |
948 // malte@kde.org's gift to KVim ;), thanks to him :) for this hard to find bug | 996 // malte@kde.org's gift to KVim ;), thanks to him :) for this hard to find bug |
949 if (wtime>0) { | 997 if (wtime > 0) |
950 gui.w->wait( wtime ); | 998 { |
951 while ( vim_is_input_buf_empty() && !gui.w->wait_done ) | 999 gui.w->wait(wtime); |
952 kapp->processOneEvent(); | 1000 while (vim_is_input_buf_empty() && !gui.w->wait_done) |
953 return vim_is_input_buf_empty() ? FAIL : OK; | 1001 kapp->processOneEvent(); |
954 } else | 1002 return vim_is_input_buf_empty() ? FAIL : OK; |
955 while (vim_is_input_buf_empty() ) { | 1003 } |
956 kapp->processOneEvent(); | 1004 else |
957 } | 1005 while (vim_is_input_buf_empty()) |
958 | 1006 kapp->processOneEvent(); |
959 return OK; | 1007 |
1008 return OK; | |
960 }//}}} | 1009 }//}}} |
961 | 1010 |
962 | 1011 |
963 /**************************************************************************** | 1012 /**************************************************************************** |
964 * Output drawing routines. | 1013 * Output drawing routines. |
965 ****************************************************************************/ | 1014 ****************************************************************************/ |
966 | 1015 |
967 | 1016 |
968 /* Flush any output to the screen */ | 1017 /* Flush any output to the screen */ |
969 void | 1018 void |
970 gui_mch_flush()//{{{ | 1019 gui_mch_flush()//{{{ |
971 { | 1020 { |
972 kapp->flushX(); | 1021 kapp->flushX(); |
973 }//}}} | 1022 }//}}} |
974 | 1023 |
975 /* | 1024 /* |
976 * Clear a rectangular region of the screen from text pos (row1, col1) to | 1025 * Clear a rectangular region of the screen from text pos (row1, col1) to |
977 * (row2, col2) inclusive. | 1026 * (row2, col2) inclusive. |
978 */ | 1027 */ |
979 void | 1028 void |
980 gui_mch_clear_block(int row1, int col1, int row2, int col2)//{{{ | 1029 gui_mch_clear_block(int row1, int col1, int row2, int col2)//{{{ |
981 { | 1030 { |
982 gui.w->erase (FILL_X(col1), FILL_Y(row1), | 1031 gui.w->erase(FILL_X(col1), FILL_Y(row1), |
983 (col2 - col1 + 1) * gui.char_width+ (col2 == Columns - 1), | 1032 (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1), |
984 (row2 - row1 + 1) * gui.char_height ); | 1033 (row2 - row1 + 1) * gui.char_height); |
985 }//}}} | 1034 }//}}} |
986 | 1035 |
987 void | 1036 void |
988 gui_mch_clear_all(void)//{{{ | 1037 gui_mch_clear_all(void)//{{{ |
989 { | 1038 { |
990 gui.w->erase(); | 1039 gui.w->erase(); |
991 }//}}} | 1040 }//}}} |
992 | 1041 |
993 | 1042 |
994 /* | 1043 /* |
995 * Delete the given number of lines from the given row, scrolling up any | 1044 * Delete the given number of lines from the given row, scrolling up any |
996 * text further down within the scroll region. | 1045 * text further down within the scroll region. |
997 */ | 1046 */ |
998 void | 1047 void |
999 gui_mch_delete_lines(int row, int num_lines)//{{{ | 1048 gui_mch_delete_lines(int row, int num_lines)//{{{ |
1000 { | 1049 { |
1001 if (num_lines <= 0) | 1050 if (num_lines <= 0) |
1002 return; | 1051 return; |
1003 | 1052 |
1004 if (row + num_lines > gui.scroll_region_bot) { | 1053 if (row + num_lines > gui.scroll_region_bot) |
1005 /* Scrolled out of region, just blank the lines out */ | 1054 { |
1006 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right); | 1055 /* Scrolled out of region, just blank the lines out */ |
1007 } else { | 1056 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, |
1008 bitBlt ( | 1057 gui.scroll_region_right); |
1009 gui.w, | 1058 } |
1010 FILL_X(gui.scroll_region_left), FILL_Y(row), | 1059 else |
1011 gui.w, | 1060 { |
1012 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), | 1061 bitBlt(gui.w, |
1013 gui.char_width * (gui.scroll_region_right -gui.scroll_region_left + 1) + 1, | 1062 FILL_X(gui.scroll_region_left), FILL_Y(row), |
1014 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1), | 1063 gui.w, |
1015 Qt::CopyROP, // raster Operation | 1064 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), |
1016 true ); // ignoreMask | 1065 gui.char_width * (gui.scroll_region_right |
1017 | 1066 - gui.scroll_region_left + 1) + 1, |
1018 /* Update gui.cursor_row if the cursor scrolled or copied over */ | 1067 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1), |
1019 if (gui.cursor_row >= row) { | 1068 Qt::CopyROP, // raster Operation |
1020 if (gui.cursor_row < row + num_lines) | 1069 true); // ignoreMask |
1021 gui.cursor_is_valid = FALSE; | 1070 |
1022 else if (gui.cursor_row <= gui.scroll_region_bot) | 1071 /* Update gui.cursor_row if the cursor scrolled or copied over */ |
1023 gui.cursor_row -= num_lines; | 1072 if (gui.cursor_row >= row) |
1024 } | 1073 { |
1025 | 1074 if (gui.cursor_row < row + num_lines) |
1026 gui_clear_block(gui.scroll_region_bot - num_lines + 1, gui.scroll_region_left, | 1075 gui.cursor_is_valid = FALSE; |
1027 gui.scroll_region_bot, gui.scroll_region_right); | 1076 else if (gui.cursor_row <= gui.scroll_region_bot) |
1028 | 1077 gui.cursor_row -= num_lines; |
1029 } | 1078 } |
1079 | |
1080 gui_clear_block(gui.scroll_region_bot - num_lines + 1, | |
1081 gui.scroll_region_left, | |
1082 gui.scroll_region_bot, gui.scroll_region_right); | |
1083 } | |
1030 }//}}} | 1084 }//}}} |
1031 | 1085 |
1032 /* | 1086 /* |
1033 * Insert the given number of lines before the given row, scrolling down any | 1087 * Insert the given number of lines before the given row, scrolling down any |
1034 * following text within the scroll region. | 1088 * following text within the scroll region. |
1035 */ | 1089 */ |
1036 void | 1090 void |
1037 gui_mch_insert_lines(int row, int num_lines)//{{{ | 1091 gui_mch_insert_lines(int row, int num_lines)//{{{ |
1038 { | 1092 { |
1039 if (num_lines <= 0) | 1093 if (num_lines <= 0) |
1040 return; | 1094 return; |
1041 | 1095 |
1042 if (row + num_lines > gui.scroll_region_bot) { | 1096 if (row + num_lines > gui.scroll_region_bot) |
1043 /* Scrolled out of region, just blank the lines out */ | 1097 { |
1044 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right - 1); | 1098 /* Scrolled out of region, just blank the lines out */ |
1045 } else { | 1099 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, |
1046 bitBlt ( | 1100 gui.scroll_region_right - 1); |
1047 gui.w, | 1101 } |
1048 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), | 1102 else |
1049 gui.w, | 1103 { |
1050 FILL_X(gui.scroll_region_left), FILL_Y(row), | 1104 bitBlt(gui.w, |
1051 gui.char_width * ( gui.scroll_region_right - gui.scroll_region_left + 1 ) + 1, | 1105 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), |
1052 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1), | 1106 gui.w, |
1053 Qt::CopyROP, // raster Operation | 1107 FILL_X(gui.scroll_region_left), FILL_Y(row), |
1054 true ); // ignoreMask | 1108 gui.char_width * ( gui.scroll_region_right |
1055 | 1109 - gui.scroll_region_left + 1 ) + 1, |
1056 /* Update gui.cursor_row if the cursor scrolled or copied over */ | 1110 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1), |
1057 if (gui.cursor_row >= gui.row) { | 1111 Qt::CopyROP, // raster Operation |
1058 if (gui.cursor_row <= gui.scroll_region_bot - num_lines) | 1112 true); // ignoreMask |
1059 gui.cursor_row += num_lines; | 1113 |
1060 else if (gui.cursor_row <= gui.scroll_region_bot) | 1114 /* Update gui.cursor_row if the cursor scrolled or copied over */ |
1061 gui.cursor_is_valid = FALSE; | 1115 if (gui.cursor_row >= gui.row) |
1062 } | 1116 { |
1063 | 1117 if (gui.cursor_row <= gui.scroll_region_bot - num_lines) |
1064 gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right); | 1118 gui.cursor_row += num_lines; |
1065 } | 1119 else if (gui.cursor_row <= gui.scroll_region_bot) |
1120 gui.cursor_is_valid = FALSE; | |
1121 } | |
1122 | |
1123 gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, | |
1124 gui.scroll_region_right); | |
1125 } | |
1066 }//}}} | 1126 }//}}} |
1067 | 1127 |
1068 /* | 1128 /* |
1069 * X Selection stuff, for cutting and pasting text to other windows. | 1129 * X Selection stuff, for cutting and pasting text to other windows. |
1070 */ | 1130 */ |
1071 void | 1131 void |
1072 clip_mch_request_selection(VimClipboard *cbd)//{{{ | 1132 clip_mch_request_selection(VimClipboard *cbd)//{{{ |
1073 { | 1133 { |
1074 #if QT_VERSION>=300 | 1134 #if QT_VERSION>=300 |
1075 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true); | 1135 if (cbd == &clip_star) |
1076 #endif | 1136 kapp->clipboard()->setSelectionMode(true); |
1077 QString selection = kapp->clipboard()->text(); | 1137 #endif |
1078 | 1138 QString selection = kapp->clipboard()->text(); |
1079 QCString unistring = vmw->codec->fromUnicode(selection); | 1139 |
1080 clip_yank_selection(MCHAR,(char_u *)(const char*)unistring,(long) unistring.length(),cbd); | 1140 QCString unistring = vmw->codec->fromUnicode(selection); |
1081 #if QT_VERSION>=300 | 1141 clip_yank_selection(MCHAR, (char_u *)(const char*)unistring, |
1082 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(false); | 1142 (long)unistring.length(), cbd); |
1083 #endif | 1143 #if QT_VERSION>=300 |
1084 }//}}} | 1144 if (cbd == &clip_star) |
1085 | 1145 kapp->clipboard()->setSelectionMode(false); |
1086 void | 1146 #endif |
1147 }//}}} | |
1148 | |
1149 void | |
1087 clip_mch_lose_selection(VimClipboard *cbd)//{{{ | 1150 clip_mch_lose_selection(VimClipboard *cbd)//{{{ |
1088 { | 1151 { |
1089 //Don't need to do anything here | 1152 // Don't need to do anything here |
1090 gui_mch_update(); | 1153 gui_mch_update(); |
1091 }//}}} | 1154 }//}}} |
1092 | 1155 |
1093 /* | 1156 /* |
1094 * Check whatever we allready own the selection. | 1157 * Check whatever we allready own the selection. |
1095 */ | 1158 */ |
1096 int | 1159 int |
1097 clip_mch_own_selection(VimClipboard *cbd)//{{{ | 1160 clip_mch_own_selection(VimClipboard *cbd)//{{{ |
1098 { | 1161 { |
1099 if (kapp->clipboard()->ownsSelection()) | 1162 if (kapp->clipboard()->ownsSelection()) |
1100 return OK; | 1163 return OK; |
1101 else { | 1164 else |
1102 #if QT_VERSION>=300 | 1165 { |
1103 kapp->clipboard()->setSelectionMode(true); | 1166 #if QT_VERSION>=300 |
1104 #endif | 1167 kapp->clipboard()->setSelectionMode(true); |
1105 return OK; | 1168 #endif |
1106 } | 1169 return OK; |
1170 } | |
1107 }//}}} | 1171 }//}}} |
1108 | 1172 |
1109 /* | 1173 /* |
1110 * Send the current selection to the clipboard. | 1174 * Send the current selection to the clipboard. |
1111 */ | 1175 */ |
1112 void | 1176 void |
1113 clip_mch_set_selection(VimClipboard *cbd){//{{{ | 1177 clip_mch_set_selection(VimClipboard *cbd)//{{{ |
1114 char_u *data; | 1178 { |
1115 long_u length; | 1179 char_u *data; |
1116 | 1180 long_u length; |
1117 clip_get_selection(cbd); | 1181 |
1118 if (clip_convert_selection(&data,&length,cbd)<0) return; | 1182 clip_get_selection(cbd); |
1119 | 1183 if (clip_convert_selection(&data, &length, cbd) < 0) |
1120 QString selection((const char *) data); | 1184 return; |
1121 //We must turncate the string because it is not | 1185 |
1122 // null terminated | 1186 QString selection((const char *)data); |
1123 selection.truncate((uint) length); | 1187 // We must turncate the string because it is not |
1124 | 1188 // null terminated |
1125 #if QT_VERSION>=300 | 1189 selection.truncate((uint) length); |
1126 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true); | 1190 |
1127 #endif | 1191 #if QT_VERSION>=300 |
1128 kapp->clipboard()->setText(selection); | 1192 if (cbd == &clip_star) |
1129 #if QT_VERSION>=300 | 1193 kapp->clipboard()->setSelectionMode(true); |
1130 kapp->clipboard()->setSelectionMode(false); | 1194 #endif |
1195 kapp->clipboard()->setText(selection); | |
1196 #if QT_VERSION>=300 | |
1197 kapp->clipboard()->setSelectionMode(false); | |
1131 #endif | 1198 #endif |
1132 }//}}} | 1199 }//}}} |
1133 | 1200 |
1134 | 1201 |
1135 #if defined(FEAT_MENU) || defined(PROTO) | 1202 #if defined(FEAT_MENU) || defined(PROTO) |
1136 /* | 1203 /* |
1137 * Make a menu item appear either active or not active (grey or not grey). | 1204 * Make a menu item appear either active or not active (grey or not grey). |
1138 */ | 1205 */ |
1139 void | 1206 void |
1140 gui_mch_menu_grey(vimmenu_T * menu, int grey)//{{{ | 1207 gui_mch_menu_grey(vimmenu_T * menu, int grey)//{{{ |
1141 { | 1208 { |
1142 if ( !menu || !menu->parent || !menu->parent->widget ) return; | 1209 if (!menu || !menu->parent || !menu->parent->widget) |
1143 menu->parent->widget->setItemEnabled((int)menu, !grey); | 1210 return; |
1144 gui_mch_update(); | 1211 menu->parent->widget->setItemEnabled((int)menu, !grey); |
1212 gui_mch_update(); | |
1145 }//}}} | 1213 }//}}} |
1146 | 1214 |
1147 /* | 1215 /* |
1148 * Make menu item hidden or not hidden. | 1216 * Make menu item hidden or not hidden. |
1149 */ | 1217 */ |
1150 void | 1218 void |
1151 gui_mch_menu_hidden(vimmenu_T * menu, int hidden)//{{{ | 1219 gui_mch_menu_hidden(vimmenu_T * menu, int hidden)//{{{ |
1152 { | 1220 { |
1153 //FIXME: cannot be fixed AFAIK | 1221 // FIXME: cannot be fixed AFAIK |
1154 gui_mch_menu_grey(menu,hidden); // it's hard to remove an item in a QPopupMenu | 1222 // it's hard to remove an item in a QPopupMenu |
1223 gui_mch_menu_grey(menu, hidden); | |
1155 }//}}} | 1224 }//}}} |
1156 | 1225 |
1157 /* | 1226 /* |
1158 * This is called after setting all the menus to grey/hidden or not. | 1227 * This is called after setting all the menus to grey/hidden or not. |
1159 */ | 1228 */ |
1160 void | 1229 void |
1161 gui_mch_draw_menubar()//{{{ | 1230 gui_mch_draw_menubar()//{{{ |
1162 { | 1231 { |
1163 // nothing to do under kde | 1232 // nothing to do under kde |
1164 }//}}} | 1233 }//}}} |
1165 #endif | 1234 #endif |
1166 | 1235 |
1167 /* | 1236 /* |
1168 * Scrollbar stuff. | 1237 * Scrollbar stuff. |
1169 */ | 1238 */ |
1170 void | 1239 void |
1171 gui_mch_enable_scrollbar(scrollbar_T * sb, int flag)//{{{ | 1240 gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)//{{{ |
1172 { | 1241 { |
1173 if (!sb->w) return; | 1242 if (!sb->w) |
1174 int width = gui.w->width(); | 1243 return; |
1175 int height = gui.w->height(); | 1244 int width = gui.w->width(); |
1176 int neww = vmw->width(); | 1245 int height = gui.w->height(); |
1177 int newh = vmw->height(); | 1246 int neww = vmw->width(); |
1178 | 1247 int newh = vmw->height(); |
1179 if (gui.which_scrollbars[SBAR_LEFT]) width += gui.scrollbar_width; | 1248 |
1180 if (gui.which_scrollbars[SBAR_RIGHT]) width += gui.scrollbar_width; | 1249 if (gui.which_scrollbars[SBAR_LEFT]) |
1181 if (gui.which_scrollbars[SBAR_BOTTOM]) height += gui.scrollbar_height; | 1250 width += gui.scrollbar_width; |
1182 | 1251 if (gui.which_scrollbars[SBAR_RIGHT]) |
1183 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() | 1252 width += gui.scrollbar_width; |
1184 #if QT_VERSION>=300 | 1253 if (gui.which_scrollbars[SBAR_BOTTOM]) |
1185 && !vmw->menuBar()->isTopLevelMenu() | 1254 height += gui.scrollbar_height; |
1186 #endif | 1255 |
1187 ) | 1256 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled() |
1188 height += vmw->menuBar()->height(); | 1257 #if QT_VERSION>=300 |
1258 && !vmw->menuBar()->isTopLevelMenu() | |
1259 #endif | |
1260 ) | |
1261 height += vmw->menuBar()->height(); | |
1189 #ifdef FEAT_TOOLBAR | 1262 #ifdef FEAT_TOOLBAR |
1190 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 1263 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
1191 (vmw->toolBar()->barPos()==KToolBar::Top || | 1264 && (vmw->toolBar()->barPos() == KToolBar::Top |
1192 vmw->toolBar()->barPos()==KToolBar::Bottom)) | 1265 || vmw->toolBar()->barPos() == KToolBar::Bottom)) |
1193 height += vmw->toolBar()->height(); | 1266 height += vmw->toolBar()->height(); |
1194 | 1267 |
1195 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() && | 1268 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() |
1196 (vmw->toolBar()->barPos()==KToolBar::Left || | 1269 && (vmw->toolBar()->barPos() == KToolBar::Left |
1197 vmw->toolBar()->barPos()==KToolBar::Right)) | 1270 || vmw->toolBar()->barPos() == KToolBar::Right)) |
1198 width += vmw->toolBar()->width(); | 1271 width += vmw->toolBar()->width(); |
1199 #endif | 1272 #endif |
1200 if ( abs(vmw->width() - width)>5 && (sb->type==SBAR_LEFT || sb->type==SBAR_RIGHT) ) | 1273 if (abs(vmw->width() - width) > 5 |
1201 neww=width; | 1274 && (sb->type == SBAR_LEFT || sb->type == SBAR_RIGHT)) |
1202 if (abs(vmw->height() - height)>5 && (sb->type==SBAR_BOTTOM) ) | 1275 neww = width; |
1203 newh=height; | 1276 if (abs(vmw->height() - height) > 5 && (sb->type == SBAR_BOTTOM)) |
1204 | 1277 newh = height; |
1205 if (flag) | 1278 |
1206 sb->w->show(); | 1279 if (flag) |
1207 else | 1280 sb->w->show(); |
1208 sb->w->hide(); | 1281 else |
1209 gui_mch_update(); | 1282 sb->w->hide(); |
1210 vmw->lock(); | 1283 gui_mch_update(); |
1211 vmw->resize(neww,newh); | 1284 vmw->lock(); |
1212 vmw->unlock(); | 1285 vmw->resize(neww, newh); |
1213 gui_mch_update(); | 1286 vmw->unlock(); |
1287 gui_mch_update(); | |
1214 }//}}} | 1288 }//}}} |
1215 | 1289 |
1216 /* | 1290 /* |
1217 * Return the RGB value of a pixel as "#RRGGBB". | 1291 * Return the RGB value of a pixel as "#RRGGBB". |
1218 */ | 1292 */ |
1219 long_u | 1293 long_u |
1220 gui_mch_get_rgb(guicolor_T pixel)//{{{ | 1294 gui_mch_get_rgb(guicolor_T pixel)//{{{ |
1221 { | 1295 { |
1222 // QColor c(pixel,pixel); | 1296 // QColor c(pixel, pixel); |
1223 // return (c.red() << 16) + ((c.green() << 8)) + (c.blue()); | 1297 // return (c.red() << 16) + ((c.green() << 8)) + (c.blue()); |
1224 return pixel; // funny no ? it looks like with Qt we can always use directly the rgb value (i hope i don't break colors again ;p) | 1298 return pixel; |
1299 // funny no ? it looks like with Qt we can always use directly the rgb | |
1300 // value (i hope i don't break colors again ;p) | |
1225 }//}}} | 1301 }//}}} |
1226 | 1302 |
1227 /* | 1303 /* |
1228 * Get current y mouse coordinate in text window. | 1304 * Get current y mouse coordinate in text window. |
1229 * Return -1 when unknown. | 1305 * Return -1 when unknown. |
1230 */ | 1306 */ |
1231 int | 1307 int |
1232 gui_mch_get_mouse_x(void)//{{{ | 1308 gui_mch_get_mouse_x(void)//{{{ |
1233 { | 1309 { |
1234 return vmw->mapFromGlobal( QCursor::pos() ).x(); | 1310 return vmw->mapFromGlobal(QCursor::pos()).x(); |
1235 }//}}} | 1311 }//}}} |
1236 | 1312 |
1237 int | 1313 int |
1238 gui_mch_get_mouse_y(void)//{{{ | 1314 gui_mch_get_mouse_y(void)//{{{ |
1239 { | 1315 { |
1240 return vmw->mapFromGlobal( QCursor::pos() ).y(); | 1316 return vmw->mapFromGlobal(QCursor::pos()).y(); |
1241 }//}}} | 1317 }//}}} |
1242 | 1318 |
1243 void | 1319 void |
1244 gui_mch_setmouse(int x, int y)//{{{ | 1320 gui_mch_setmouse(int x, int y)//{{{ |
1245 { | 1321 { |
1246 QCursor::setPos( vmw->mapToGlobal( QPoint(x,y)) ); | 1322 QCursor::setPos(vmw->mapToGlobal(QPoint(x, y))); |
1247 }//}}} | 1323 }//}}} |
1248 | 1324 |
1249 #if defined(FEAT_MOUSESHAPE) || defined(PROTO) | 1325 #if defined(FEAT_MOUSESHAPE) || defined(PROTO) |
1250 #if QT_VERSION>=300 | 1326 #if QT_VERSION>=300 |
1251 static int mshape_ids[] = {//{{{ | 1327 static int mshape_ids[] = {//{{{ |
1254 Qt::IbeamCursor, /* beam */ | 1330 Qt::IbeamCursor, /* beam */ |
1255 Qt::SizeVerCursor, /* updown */ | 1331 Qt::SizeVerCursor, /* updown */ |
1256 Qt::SplitHCursor, /* udsizing */ | 1332 Qt::SplitHCursor, /* udsizing */ |
1257 Qt::SizeHorCursor, /* leftright */ | 1333 Qt::SizeHorCursor, /* leftright */ |
1258 Qt::SizeHorCursor, /* lrsizing */ | 1334 Qt::SizeHorCursor, /* lrsizing */ |
1259 Qt::WaitCursor, /* busy */ | 1335 Qt::WaitCursor, /* busy */ |
1260 Qt::ForbiddenCursor, /* no */ | 1336 Qt::ForbiddenCursor, /* no */ |
1261 Qt::CrossCursor, /* crosshair */ | 1337 Qt::CrossCursor, /* crosshair */ |
1262 Qt::PointingHandCursor, /* hand1 */ | 1338 Qt::PointingHandCursor, /* hand1 */ |
1263 Qt::PointingHandCursor, /* hand2 */ | 1339 Qt::PointingHandCursor, /* hand2 */ |
1264 Qt::ArrowCursor, /* pencil */ | 1340 Qt::ArrowCursor, /* pencil */ |
1265 Qt::WhatsThisCursor, /* question */ | 1341 Qt::WhatsThisCursor, /* question */ |
1266 Qt::ArrowCursor, /* right-arrow */ | 1342 Qt::ArrowCursor, /* right-arrow */ |
1267 Qt::UpArrowCursor, /* up-arrow */ | 1343 Qt::UpArrowCursor, /* up-arrow */ |
1268 Qt::ArrowCursor /* last one */ | 1344 Qt::ArrowCursor /* last one */ |
1269 };//}}} | 1345 };//}}} |
1270 #else | 1346 #else |
1271 static int mshape_ids[] = {//{{{ | 1347 static int mshape_ids[] = {//{{{ |
1272 ArrowCursor, /* arrow */ | 1348 ArrowCursor, /* arrow */ |
1273 BlankCursor, /* blank */ | 1349 BlankCursor, /* blank */ |
1274 IbeamCursor, /* beam */ | 1350 IbeamCursor, /* beam */ |
1275 SizeVerCursor, /* updown */ | 1351 SizeVerCursor, /* updown */ |
1276 SplitHCursor, /* udsizing */ | 1352 SplitHCursor, /* udsizing */ |
1277 SizeHorCursor, /* leftright */ | 1353 SizeHorCursor, /* leftright */ |
1278 SizeHorCursor, /* lrsizing */ | 1354 SizeHorCursor, /* lrsizing */ |
1279 WaitCursor, /* busy */ | 1355 WaitCursor, /* busy */ |
1280 ForbiddenCursor, /* no */ | 1356 ForbiddenCursor, /* no */ |
1281 CrossCursor, /* crosshair */ | 1357 CrossCursor, /* crosshair */ |
1282 PointingHandCursor, /* hand1 */ | 1358 PointingHandCursor, /* hand1 */ |
1283 PointingHandCursor, /* hand2 */ | 1359 PointingHandCursor, /* hand2 */ |
1284 ArrowCursor, /* pencil */ | 1360 ArrowCursor, /* pencil */ |
1285 ArrowCursor, /* question */ | 1361 ArrowCursor, /* question */ |
1286 ArrowCursor, /* right-arrow */ | 1362 ArrowCursor, /* right-arrow */ |
1287 UpArrowCursor, /* up-arrow */ | 1363 UpArrowCursor, /* up-arrow */ |
1288 ArrowCursor /* last one */ | 1364 ArrowCursor /* last one */ |
1289 };//}}} | 1365 };//}}} |
1290 #endif | 1366 #endif |
1291 | 1367 |
1292 void | 1368 void |
1293 mch_set_mouse_shape (int shape)//{{{ | 1369 mch_set_mouse_shape (int shape)//{{{ |
1294 { | 1370 { |
1295 int id; | 1371 int id; |
1296 | 1372 |
1297 if (shape == MSHAPE_HIDE || gui.pointer_hidden) | 1373 if (shape == MSHAPE_HIDE || gui.pointer_hidden) |
1298 #if QT_VERSION>=300 | 1374 #if QT_VERSION>=300 |
1299 gui.w->setCursor(Qt::BlankCursor); | 1375 gui.w->setCursor(Qt::BlankCursor); |
1300 #else | 1376 #else |
1301 gui.w->setCursor(BlankCursor); | 1377 gui.w->setCursor(BlankCursor); |
1302 #endif | 1378 #endif |
1379 else | |
1380 { | |
1381 if (shape >= MSHAPE_NUMBERED) | |
1382 { | |
1383 id = shape - MSHAPE_NUMBERED; | |
1384 /* if (id >= GDK_NUM_GLYPHS) | |
1385 id = GDK_LEFT_PTR; | |
1386 else | |
1387 id &= ~1;*/ /* they are always even (why?) */ | |
1388 id &= -1; | |
1389 } | |
1303 else | 1390 else |
1304 { | 1391 id = mshape_ids[shape]; |
1305 if (shape >= MSHAPE_NUMBERED) | 1392 |
1306 { | 1393 gui.w->setCursor(id); |
1307 id = shape - MSHAPE_NUMBERED; | 1394 } |
1308 /* if (id >= GDK_NUM_GLYPHS) | 1395 if (shape != MSHAPE_HIDE) |
1309 id = GDK_LEFT_PTR; | 1396 last_shape = shape; |
1310 else | 1397 }//}}} |
1311 id &= ~1;*/ /* they are always even (why?) */ | 1398 #endif |
1312 id &= -1; | 1399 |
1313 } | 1400 int |
1314 else | |
1315 id = mshape_ids[shape]; | |
1316 | |
1317 gui.w->setCursor(id); | |
1318 } | |
1319 if (shape != MSHAPE_HIDE) | |
1320 last_shape = shape; | |
1321 }//}}} | |
1322 #endif | |
1323 | |
1324 int | |
1325 gui_mch_adjust_charsize ()//{{{ | 1401 gui_mch_adjust_charsize ()//{{{ |
1326 { | 1402 { |
1327 QFont f(*(gui.current_font)); | 1403 QFont f(*(gui.current_font)); |
1328 QFontMetrics fm (f); | 1404 QFontMetrics fm(f); |
1329 gui.char_height = fm.height() + p_linespace; | 1405 gui.char_height = fm.height() + p_linespace; |
1330 //gui.char_height = fm.ascent() + fm.descent() + p_linespace; | 1406 //gui.char_height = fm.ascent() + fm.descent() + p_linespace; |
1331 gui.char_ascent = fm.ascent() + p_linespace/2; | 1407 gui.char_ascent = fm.ascent() + p_linespace / 2; |
1332 | 1408 |
1333 return OK; | 1409 return OK; |
1334 }//}}} | 1410 }//}}} |
1335 | 1411 |
1336 void | 1412 void |
1337 gui_mch_set_foreground ()//{{{ | 1413 gui_mch_set_foreground ()//{{{ |
1338 { | 1414 { |
1339 KWin::setActiveWindow(vmw->winId()); | 1415 KWin::setActiveWindow(vmw->winId()); |
1340 }//}}} | 1416 }//}}} |
1341 | |
1342 | |
1343 |