/[weechat]/weechat/src/common/command.c
ViewVC logotype

Diff of /weechat/src/common/command.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.83 by flashcode, Fri Nov 11 10:56:47 2005 UTC revision 1.84 by flashcode, Sun Nov 13 15:51:01 2005 UTC
# Line 66  t_weechat_command weechat_commands[] = Line 66  t_weechat_command weechat_commands[] =
66      N_("servername: server name to disconnect"),      N_("servername: server name to disconnect"),
67      0, 1, weechat_cmd_disconnect, NULL },      0, 1, weechat_cmd_disconnect, NULL },
68    { "debug", N_("print debug messages"),    { "debug", N_("print debug messages"),
69      N_("dump"),      N_("dump | windows"),
70      N_("dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)"),      N_("dump: save memory dump in WeeChat log file (same dump is written when WeeChat crashes)\n"
71           "windows: display windows tree"),
72      1, 1, weechat_cmd_debug, NULL },      1, 1, weechat_cmd_debug, NULL },
73    { "help", N_("display help about commands"),    { "help", N_("display help about commands"),
74      N_("[command]"), N_("command: name of a WeeChat or IRC command"),      N_("[command]"), N_("command: name of a WeeChat or IRC command"),
# Line 140  t_weechat_command weechat_commands[] = Line 141  t_weechat_command weechat_commands[] =
141      N_("-o: send uptime on current channel as an IRC message"),      N_("-o: send uptime on current channel as an IRC message"),
142      0, 1, weechat_cmd_uptime, NULL },      0, 1, weechat_cmd_uptime, NULL },
143    { "window", N_("manage windows"),    { "window", N_("manage windows"),
144      N_("[list | -1 | +1 | b# | splith | splitv | [merge [down | up | left | right | all]]]"),      N_("[list | -1 | +1 | b# | splith [pct] | splitv [pct] | [merge [all]]]"),
145      N_("list: list opened windows (no parameter implies this list)\n"      N_("list: list opened windows (no parameter implies this list)\n"
146         "-1: jump to previous window\n"         "-1: jump to previous window\n"
147         "+1: jump to next window\n"         "+1: jump to next window\n"
148         "b#: jump to next window displaying buffer number #\n"         "b#: jump to next window displaying buffer number #\n"
149         "splith: split current window horizontally\n"         "splith: split current window horizontally\n"
150         "splitv: split current window vertically\n"         "splitv: split current window vertically\n"
151         "merge: merge window with another"),         "merge: merge window with another (all = keep only one window)\n\n"
152           "For splith and splitv, pct is a pourcentage which represents "
153           "size of new window, computed with current window as size reference. "
154           "For example 25 means create a new window with size = current_size / 4"),
155      0, 2, weechat_cmd_window, NULL },      0, 2, weechat_cmd_window, NULL },
156    { NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }    { NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
157  };  };
# Line 1297  weechat_cmd_connect (int argc, char **ar Line 1301  weechat_cmd_connect (int argc, char **ar
1301  }  }
1302    
1303  /*  /*
1304     * weechat_cmd_debug_display_windows: display tree of windows
1305     */
1306    
1307    void
1308    weechat_cmd_debug_display_windows (t_gui_window_tree *tree, int indent)
1309    {
1310        int i;
1311        
1312        if (tree)
1313        {
1314            for (i = 0; i < indent; i++)
1315                gui_printf_nolog (NULL, "  ");
1316            
1317            if (tree->window)
1318            {
1319                /* leaf */
1320                gui_printf_nolog (NULL, "leaf: %X (parent:%X), win=%X, child1=%X, child2=%X, %d,%d %dx%d, %d%%x%d%%\n",
1321                                  tree, tree->parent_node, tree->window,
1322                                  tree->child1, tree->child2,
1323                                  tree->window->win_x, tree->window->win_y,
1324                                  tree->window->win_width, tree->window->win_height,
1325                                  tree->window->win_width_pct, tree->window->win_height_pct);
1326            }
1327            else
1328            {
1329                /* node */
1330                gui_printf_nolog (NULL, "node: %X (parent:%X), win=%X, child1=%X, child2=%X)\n",
1331                                  tree, tree->parent_node, tree->window,
1332                                  tree->child1, tree->child2);
1333            }
1334            
1335            if (tree->child1)
1336                weechat_cmd_debug_display_windows (tree->child1, indent + 1);
1337            if (tree->child2)
1338                weechat_cmd_debug_display_windows (tree->child2, indent + 1);
1339        }
1340    }
1341    
1342    /*
1343   * weechat_cmd_debug: print debug messages   * weechat_cmd_debug: print debug messages
1344   */   */
1345    
# Line 1316  weechat_cmd_debug (int argc, char **argv Line 1359  weechat_cmd_debug (int argc, char **argv
1359      {      {
1360          wee_dump (0);          wee_dump (0);
1361      }      }
1362        else if (ascii_strcasecmp (argv[0], "windows") == 0)
1363        {
1364            gui_printf_nolog (NULL, "\n");
1365            gui_printf_nolog (NULL, "DEBUG: windows tree:\n");
1366            weechat_cmd_debug_display_windows (gui_windows_tree, 1);
1367        }
1368      else      else
1369      {      {
1370          irc_display_prefix (NULL, NULL, PREFIX_ERROR);          irc_display_prefix (NULL, NULL, PREFIX_ERROR);
# Line 1918  weechat_cmd_server (int argc, char **arg Line 1967  weechat_cmd_server (int argc, char **arg
1967      int i;      int i;
1968      t_irc_server server, *ptr_server, *server_found, *new_server;      t_irc_server server, *ptr_server, *server_found, *new_server;
1969      t_gui_buffer *ptr_buffer;      t_gui_buffer *ptr_buffer;
1970        char *server_name;
1971            
1972      if ((argc == 0) || (argc == 1))      if ((argc == 0) || (argc == 1))
1973      {      {
# Line 2008  weechat_cmd_server (int argc, char **arg Line 2058  weechat_cmd_server (int argc, char **arg
2058                  }                  }
2059              }              }
2060                            
2061                server_name = strdup (server_found->name);
2062                
2063              server_free (server_found);              server_free (server_found);
2064                            
2065              irc_display_prefix (NULL, NULL, PREFIX_INFO);              irc_display_prefix (NULL, NULL, PREFIX_INFO);
2066              gui_printf (NULL, _("Server %s%s%s has been deleted\n"),              gui_printf (NULL, _("Server %s%s%s has been deleted\n"),
2067                          GUI_COLOR(COLOR_WIN_CHAT_SERVER),                          GUI_COLOR(COLOR_WIN_CHAT_SERVER),
2068                          server_found->name,                          server_name,
2069                          GUI_COLOR(COLOR_WIN_CHAT));                          GUI_COLOR(COLOR_WIN_CHAT));
2070                if (server_name)
2071                    free (server_name);
2072                            
2073              gui_redraw_buffer (gui_current_window->buffer);              gui_redraw_buffer (gui_current_window->buffer);
2074                            
# Line 2758  weechat_cmd_window (int argc, char **arg Line 2812  weechat_cmd_window (int argc, char **arg
2812          if (ascii_strcasecmp (argv[0], "splith") == 0)          if (ascii_strcasecmp (argv[0], "splith") == 0)
2813          {          {
2814              /* split window horizontally */              /* split window horizontally */
2815              gui_window_split_horiz (gui_current_window);              if (argc > 1)
2816                {
2817                    error = NULL;
2818                    number = strtol (argv[1], &error, 10);
2819                    if ((error) && (error[0] == '\0')
2820                        && (number > 0) && (number < 100))
2821                        gui_window_split_horiz (gui_current_window, number);
2822                }
2823                else
2824                    gui_window_split_horiz (gui_current_window, 50);
2825          }          }
2826          else if (ascii_strcasecmp (argv[0], "splitv") == 0)          else if (ascii_strcasecmp (argv[0], "splitv") == 0)
2827          {          {
2828              /* split window vertically */              /* split window vertically */
2829              gui_window_split_vertic (gui_current_window);              if (argc > 1)
2830                {
2831                    error = NULL;
2832                    number = strtol (argv[1], &error, 10);
2833                    if ((error) && (error[0] == '\0')
2834                        && (number > 0) && (number < 100))
2835                        gui_window_split_vertic (gui_current_window, number);
2836                }
2837                else
2838                    gui_window_split_vertic (gui_current_window, 50);
2839          }          }
2840          else if (ascii_strcasecmp (argv[0], "merge") == 0)          else if (ascii_strcasecmp (argv[0], "merge") == 0)
2841          {          {
2842              if (argc >= 2)              if (argc >= 2)
2843              {              {
2844                  if (ascii_strcasecmp (argv[1], "down") == 0)                  if (ascii_strcasecmp (argv[1], "all") == 0)
                     gui_window_merge_down (gui_current_window);  
                 else if (ascii_strcasecmp (argv[1], "up") == 0)  
                     gui_window_merge_up (gui_current_window);  
                 else if (ascii_strcasecmp (argv[1], "left") == 0)  
                     gui_window_merge_left (gui_current_window);  
                 else if (ascii_strcasecmp (argv[1], "right") == 0)  
                     gui_window_merge_right (gui_current_window);  
                 else if (ascii_strcasecmp (argv[1], "all") == 0)  
2845                      gui_window_merge_all (gui_current_window);                      gui_window_merge_all (gui_current_window);
2846                  else                  else
2847                  {                  {
# Line 2789  weechat_cmd_window (int argc, char **arg Line 2853  weechat_cmd_window (int argc, char **arg
2853                  }                  }
2854              }              }
2855              else              else
2856                  gui_window_merge_auto (gui_current_window);              {
2857                    if (!gui_window_merge (gui_current_window))
2858                    {
2859                        irc_display_prefix (NULL, NULL, PREFIX_ERROR);
2860                        gui_printf (NULL,
2861                                    _("%s can not merge windows, "
2862                                      "there's no other window with same size "
2863                                      "near current one.\n"),
2864                                    WEECHAT_ERROR);
2865                        return -1;
2866                    }
2867                }
2868          }          }
2869          else if (ascii_strncasecmp (argv[0], "b", 1) == 0)          else if (ascii_strncasecmp (argv[0], "b", 1) == 0)
2870          {          {

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.84

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26