1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Code not following Vim coding style.
12 Solution: Fix the style. (Elias Diem)
13 Files: src/gui_photon.c
16 *** ../vim-7.3.270/src/gui_photon.c 2011-07-27 14:09:05.000000000 +0200
17 --- src/gui_photon.c 2011-08-10 12:18:35.000000000 +0200
23 ! gui_ph_handle_window_cb( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
25 PhWindowEvent_t *we = info->cbdata;
26 ushort_t *width, *height;
28 ! switch( we->event_f ) {
34 /* Just in case it's hidden and needs to be shown */
35 ! gui_mch_mousehide( MOUSE_SHOW );
37 ! if( we->event_state == Ph_WM_EVSTATE_FOCUS )
39 gui_focus_change(TRUE);
40 gui_mch_start_blink();
45 ! gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
47 PhWindowEvent_t *we = info->cbdata;
48 ushort_t *width, *height;
50 ! switch (we->event_f) {
56 /* Just in case it's hidden and needs to be shown */
57 ! gui_mch_mousehide(MOUSE_SHOW);
59 ! if (we->event_state == Ph_WM_EVSTATE_FOCUS)
61 gui_focus_change(TRUE);
62 gui_mch_start_blink();
68 ! PtGetResource( gui.vimWindow, Pt_ARG_WIDTH, &width, 0 );
69 ! PtGetResource( gui.vimWindow, Pt_ARG_HEIGHT, &height, 0 );
70 #ifdef USE_PANEL_GROUP
71 width -= (pg_margin_left + pg_margin_right);
72 height -= (pg_margin_top + pg_margin_bottom);
74 ! gui_resize_shell( *width, *height );
75 ! gui_set_shellsize( FALSE, FALSE, RESIZE_BOTH );
76 is_ignore_draw = FALSE;
77 ! PtEndFlux( gui.vimContainer );
78 ! PtContainerRelease( gui.vimContainer );
86 ! PtGetResource(gui.vimWindow, Pt_ARG_WIDTH, &width, 0);
87 ! PtGetResource(gui.vimWindow, Pt_ARG_HEIGHT, &height, 0);
88 #ifdef USE_PANEL_GROUP
89 width -= (pg_margin_left + pg_margin_right);
90 height -= (pg_margin_top + pg_margin_bottom);
92 ! gui_resize_shell(*width, *height);
93 ! gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH);
94 is_ignore_draw = FALSE;
95 ! PtEndFlux(gui.vimContainer);
96 ! PtContainerRelease(gui.vimContainer);
105 ! gui_ph_handle_scrollbar( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
107 PtScrollbarCallback_t *scroll;
113 ! gui_ph_handle_scrollbar(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
115 PtScrollbarCallback_t *scroll;
119 scroll = info->cbdata;
121 sb = (scrollbar_T *) data;
124 value = scroll->position;
125 ! switch( scroll->action )
127 case Pt_SCROLL_DRAGGED:
130 scroll = info->cbdata;
132 sb = (scrollbar_T *) data;
135 value = scroll->position;
136 ! switch (scroll->action)
138 case Pt_SCROLL_DRAGGED:
145 ! gui_ph_handle_keyboard( PtWidget_t *widget, void *data, PtCallbackInfo_t *info )
148 unsigned char string[6];
152 ! key = PhGetData( info->event );
154 ch = modifiers = len = 0;
157 ! gui_mch_mousehide( MOUSE_HIDE );
159 /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */
160 ! if( key->key_flags & Pk_KF_Compose )
165 ! if( (key->key_flags & Pk_KF_Cap_Valid) &&
166 ! PkIsKeyDown( key->key_flags ) )
170 * Only show the menu if the Alt key is down, and the Shift & Ctrl
171 * keys aren't down, as well as the other conditions
173 ! if( ( ( key->key_mods & Pk_KM_Alt ) &&
174 ! !( key->key_mods & Pk_KM_Shift ) &&
175 ! !( key->key_mods & Pk_KM_Ctrl ) ) &&
176 gui.menu_is_active &&
179 ! gui_is_menu_shortcut( key->key_cap ) ) ) )
181 /* Fallthrough and let photon look for the hotkey */
186 ! for( i = 0; special_keys[i].key_sym != 0; i++ )
188 ! if( special_keys[i].key_sym == key->key_cap )
191 ! if( special_keys[i].vim_code1 == NUL )
192 ch = special_keys[i].vim_code0;
195 /* Detect if a keypad number key has been pressed
196 * and change the key if Num Lock is on */
197 ! if( key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9
198 ! && ( key->key_mods & Pk_KM_Num_Lock ) )
200 /* FIXME: For now, just map the key to a ascii value
201 * (see <photon/PkKeyDef.h>) */
202 ch = key->key_cap - 0xf080;
205 ! ch = TO_SPECIAL( special_keys[i].vim_code0,
206 ! special_keys[i].vim_code1 );
212 ! if( key->key_mods & Pk_KM_Ctrl )
213 modifiers |= MOD_MASK_CTRL;
214 ! if( key->key_mods & Pk_KM_Alt )
215 modifiers |= MOD_MASK_ALT;
216 ! if( key->key_mods & Pk_KM_Shift )
217 modifiers |= MOD_MASK_SHIFT;
219 /* Is this not a special key? */
220 ! if( special_keys[i].key_sym == 0 )
222 ! ch = PhTo8859_1( key );
225 ! || ( enc_utf8 && ch > 127 )
230 ! len = PhKeyToMb( string, key );
234 int src_taken, dst_made;
235 ! if( enc_utf8 != TRUE )
243 ! gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info)
246 unsigned char string[6];
250 ! key = PhGetData(info->event);
252 ch = modifiers = len = 0;
255 ! gui_mch_mousehide(MOUSE_HIDE);
257 /* We're a good lil photon program, aren't we? yes we are, yeess wee arrr */
258 ! if (key->key_flags & Pk_KF_Compose)
263 ! if ((key->key_flags & Pk_KF_Cap_Valid) &&
264 ! PkIsKeyDown(key->key_flags))
268 * Only show the menu if the Alt key is down, and the Shift & Ctrl
269 * keys aren't down, as well as the other conditions
271 ! if (((key->key_mods & Pk_KM_Alt) &&
272 ! !(key->key_mods & Pk_KM_Shift) &&
273 ! !(key->key_mods & Pk_KM_Ctrl)) &&
274 gui.menu_is_active &&
277 ! gui_is_menu_shortcut(key->key_cap))))
279 /* Fallthrough and let photon look for the hotkey */
284 ! for(i = 0; special_keys[i].key_sym != 0; i++)
286 ! if (special_keys[i].key_sym == key->key_cap)
289 ! if (special_keys[i].vim_code1 == NUL)
290 ch = special_keys[i].vim_code0;
293 /* Detect if a keypad number key has been pressed
294 * and change the key if Num Lock is on */
295 ! if (key->key_cap >= Pk_KP_Enter && key->key_cap <= Pk_KP_9
296 ! && (key->key_mods & Pk_KM_Num_Lock))
298 /* FIXME: For now, just map the key to a ascii value
299 * (see <photon/PkKeyDef.h>) */
300 ch = key->key_cap - 0xf080;
303 ! ch = TO_SPECIAL(special_keys[i].vim_code0,
304 ! special_keys[i].vim_code1);
310 ! if (key->key_mods & Pk_KM_Ctrl)
311 modifiers |= MOD_MASK_CTRL;
312 ! if (key->key_mods & Pk_KM_Alt)
313 modifiers |= MOD_MASK_ALT;
314 ! if (key->key_mods & Pk_KM_Shift)
315 modifiers |= MOD_MASK_SHIFT;
317 /* Is this not a special key? */
318 ! if (special_keys[i].key_sym == 0)
320 ! ch = PhTo8859_1(key);
323 ! || (enc_utf8 && ch > 127)
328 ! len = PhKeyToMb(string, key);
332 int src_taken, dst_made;
333 ! if (enc_utf8 != TRUE)
339 name_len = (int_u) ( mark - vim_font );
341 *font_name = vim_strnsave( vim_font, name_len );
342 ! if( *font_name != NULL )
346 ! while( *mark != NUL && *mark++ == ':')
348 ! switch( tolower( *mark++ ) )
350 case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break;
351 case 'b': *font_flags |= PF_STYLE_BOLD; break;
353 name_len = (int_u) ( mark - vim_font );
355 *font_name = vim_strnsave( vim_font, name_len );
356 ! if (*font_name != NULL)
360 ! while (*mark != NUL && *mark++ == ':')
362 ! switch (tolower(*mark++))
364 case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break;
365 case 'b': *font_flags |= PF_STYLE_BOLD; break;
369 size = getdigits( &mark );
370 /* Restrict the size to some vague limits */
371 ! if( size < 1 || size > 100 )
377 size = getdigits( &mark );
378 /* Restrict the size to some vague limits */
379 ! if (size < 1 || size > 100)
388 ! if( vim_font_name == NULL )
391 vim_font_name = "PC Terminal";
394 ! if( STRCMP( vim_font_name, "*" ) == 0 )
396 font_tag = PtFontSelection( gui.vimWindow, NULL, NULL,
397 "pcterm12", -1, PHFONT_FIXED, NULL );
399 ! if( font_tag == NULL )
402 gui_mch_free_font( gui.norm_font );
407 ! if (vim_font_name == NULL)
410 vim_font_name = "PC Terminal";
413 ! if (STRCMP( vim_font_name, "*" ) == 0)
415 font_tag = PtFontSelection( gui.vimWindow, NULL, NULL,
416 "pcterm12", -1, PHFONT_FIXED, NULL );
418 ! if (font_tag == NULL)
421 gui_mch_free_font( gui.norm_font );
427 ! if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
428 ! &font_size ) == FALSE )
431 font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 );
432 ! if( font_tag == NULL )
434 vim_free( font_name );
440 ! if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
441 ! &font_size ) == FALSE)
444 font_tag = gui_ph_get_font( font_name, font_flags, font_size, 0 );
445 ! if (font_tag == NULL)
447 vim_free( font_name );
451 int_u font_size = 12;
452 int_u font_flags = 0;
454 ! if( gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
455 ! &font_size ) != FALSE )
457 font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 );
458 vim_free( font_name );
460 ! if( font_tag != NULL )
461 return (GuiFont)font_tag;
465 EMSG2(e_font, vim_font_name );
469 int_u font_size = 12;
470 int_u font_flags = 0;
472 ! if (gui_ph_parse_font_name( vim_font_name, &font_name, &font_flags,
473 ! &font_size ) != FALSE)
475 font_tag = gui_ph_get_font( font_name, font_flags, font_size, -1 );
476 vim_free( font_name );
478 ! if (font_tag != NULL)
479 return (GuiFont)font_tag;
483 EMSG2(e_font, vim_font_name );
486 *** ../vim-7.3.270/src/version.c 2011-08-10 12:10:55.000000000 +0200
487 --- src/version.c 2011-08-10 12:17:06.000000000 +0200
491 { /* Add new patch number below this line */
497 An indication you must be a manager:
498 You believe you never have any problems in your life, just
499 "issues" and "improvement opportunities".
501 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
502 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
503 \\\ an exciting new programming language -- http://www.Zimbu.org ///
504 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///