void MYMENU_ViewSplitView() { static int splitview = 0; if ( splitview == 0 ) { // get the cell where to split int start_row = 0; int start_col = 0; int end_row, end_col; get_selection( &start_row, &start_col, &end_row, &end_col ); // get x/y pos int xx = current_view()->edge[ VIEW_LEFT ] + col_zero_width; int yy = current_view()->edge[ VIEW_TOP ] + row_zero_height; int p; for ( p = current_view()->col_head; p < start_col; ++p ) xx += col_width_of( p ) * ratio; for ( p = current_view()->row_head; p < start_row; ++p ) yy += row_height_of( p ) * ratio; // NOTE: always shift a bit to let the user select the last row/col if ( xx != current_view()->edge[ VIEW_LEFT ] + col_zero_width ) { split_view( xx + 1, -1 ); splitview = 1; } if ( yy != current_view()->edge[ VIEW_TOP ] + row_zero_height ) { split_view( -1, yy + 1 ); splitview = 1; } } else { restore_view(); splitview = 0; } update_selection_rect(); update_table_view(); }
static void kb_activate(guint key_id) { switch (key_id) { case KB_SPLIT_HORIZONTAL: if (plugin_state == STATE_UNSPLIT) split_view(TRUE); break; case KB_SPLIT_VERTICAL: if (plugin_state == STATE_UNSPLIT) split_view(FALSE); break; case KB_SPLIT_UNSPLIT: if (plugin_state != STATE_UNSPLIT) on_unsplit(NULL, NULL); break; } }
static void on_split_vertically(GtkMenuItem *menuitem, gpointer user_data) { split_view(FALSE); }
static void on_split_horizontally(GtkMenuItem *menuitem, gpointer user_data) { split_view(TRUE); }
static void cmd_ctrl_wv(key_info_t key_info, keys_info_t *keys_info) { split_view(VSPLIT); view_redraw(); }