forked from bartvdbraak/blender
- WM_OT_context_cycle_int wasnt working (also wasnt used anywhere)
- remove console zoom operator, use WM_OT_context_cycle_int instead. - use WM_OT_context_cycle_int for text editor zoom also (Ctrl +/- and Ctrl+MouseWheel)
This commit is contained in:
parent
e2f5d31453
commit
9bda43ed27
@ -204,25 +204,26 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
value = context_path_validate(context, self.properties.path)
|
||||
path = self.properties.path
|
||||
value = context_path_validate(context, path)
|
||||
if value is Ellipsis:
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
self.properties.value = value
|
||||
if self.properties.reverse:
|
||||
self.properties.value -= 1
|
||||
value -= 1
|
||||
else:
|
||||
self.properties.value += 1
|
||||
execute_context_assign(self, context)
|
||||
value += 1
|
||||
|
||||
if self.properties.value != eval("context.%s" % self.properties.path):
|
||||
exec("context.%s=value" % path)
|
||||
|
||||
if value != eval("context.%s" % path):
|
||||
# relies on rna clamping int's out of the range
|
||||
if self.properties.reverse:
|
||||
self.properties.value = (1 << 32)
|
||||
value = (1 << 32)
|
||||
else:
|
||||
self.properties.value = - (1 << 32)
|
||||
execute_context_assign(self, context)
|
||||
value = - (1 << 32)
|
||||
|
||||
exec("context.%s=value" % path)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
@ -63,7 +63,6 @@ void CONSOLE_OT_clear(struct wmOperatorType *ot);
|
||||
void CONSOLE_OT_history_cycle(struct wmOperatorType *ot);
|
||||
void CONSOLE_OT_copy(struct wmOperatorType *ot);
|
||||
void CONSOLE_OT_paste(struct wmOperatorType *ot);
|
||||
void CONSOLE_OT_zoom(struct wmOperatorType *ot);
|
||||
void CONSOLE_OT_select_set(struct wmOperatorType *ot);
|
||||
|
||||
|
||||
|
@ -750,38 +750,6 @@ void CONSOLE_OT_paste(wmOperatorType *ot)
|
||||
/* properties */
|
||||
}
|
||||
|
||||
static int zoom_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceConsole *sc= CTX_wm_space_console(C);
|
||||
|
||||
int delta= RNA_int_get(op->ptr, "delta");
|
||||
|
||||
sc->lheight += delta;
|
||||
CLAMP(sc->lheight, 8, 32);
|
||||
|
||||
ED_area_tag_redraw(CTX_wm_area(C));
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
void CONSOLE_OT_zoom(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
ot->name= "Console Zoom";
|
||||
/*optionals -
|
||||
"Zoom view font." */
|
||||
ot->description= "Zoom screen area.";
|
||||
ot->idname= "CONSOLE_OT_zoom";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec= zoom_exec;
|
||||
ot->poll= console_poll;
|
||||
|
||||
/* properties */
|
||||
RNA_def_int(ot->srna, "delta", 0, 0, INT_MAX, "Delta", "Scale the view font.", 0, 1000);
|
||||
}
|
||||
|
||||
typedef struct SetConsoleCursor {
|
||||
int sel_old[2];
|
||||
int sel_init;
|
||||
|
@ -207,7 +207,6 @@ void console_operatortypes(void)
|
||||
WM_operatortype_append(CONSOLE_OT_history_cycle);
|
||||
WM_operatortype_append(CONSOLE_OT_copy);
|
||||
WM_operatortype_append(CONSOLE_OT_paste);
|
||||
WM_operatortype_append(CONSOLE_OT_zoom);
|
||||
WM_operatortype_append(CONSOLE_OT_select_set);
|
||||
|
||||
/* console_report.c */
|
||||
@ -223,6 +222,7 @@ void console_operatortypes(void)
|
||||
void console_keymap(struct wmKeyConfig *keyconf)
|
||||
{
|
||||
wmKeyMap *keymap= WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
#ifdef __APPLE__
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
|
||||
@ -235,13 +235,22 @@ void console_keymap(struct wmKeyConfig *keyconf)
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", HOMEKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_BEGIN);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", ENDKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_END);
|
||||
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_zoom", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_zoom", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
|
||||
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_zoom", PADPLUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_zoom", PADMINUS, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 1);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 1);
|
||||
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR);
|
||||
RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR);
|
||||
|
||||
|
@ -209,6 +209,7 @@ static void text_operatortypes(void)
|
||||
static void text_keymap(struct wmKeyConfig *keyconf)
|
||||
{
|
||||
wmKeyMap *keymap;
|
||||
wmKeyMapItem *kmi;
|
||||
|
||||
keymap= WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
|
||||
|
||||
@ -229,6 +230,22 @@ static void text_keymap(struct wmKeyConfig *keyconf)
|
||||
WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
|
||||
#endif
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 1);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 0);
|
||||
|
||||
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", PADMINUS, KM_PRESS, KM_CTRL, 0);
|
||||
RNA_string_set(kmi->ptr, "path", "space_data.font_size");
|
||||
RNA_boolean_set(kmi->ptr, "reverse", 1);
|
||||
|
||||
WM_keymap_add_item(keymap, "TEXT_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "TEXT_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
|
||||
WM_keymap_add_item(keymap, "TEXT_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user