* panel.h: Fix duplication between cpanel and current_panel in

favor of current_panel.  Ditto opanel and other_panel.
This commit is contained in:
Pavel Roskin 2003-10-26 06:45:59 +00:00
parent bb13ad8db4
commit 24384e9a89
23 changed files with 203 additions and 203 deletions

View File

@ -1,5 +1,8 @@
2003-10-26 Pavel Roskin <proski@gnu.org> 2003-10-26 Pavel Roskin <proski@gnu.org>
* panel.h: Fix duplication between cpanel and current_panel in
favor of current_panel. Ditto opanel and other_panel.
* main.c (get_current_panel): Remove. * main.c (get_current_panel): Remove.
(get_other_panel): Move ... (get_other_panel): Move ...
* layout.c: ... here. * layout.c: ... here.

View File

@ -355,7 +355,7 @@ static void chown_refresh (void)
if (!single_set){ if (!single_set){
dlg_move (ch_dlg, 3, 54); dlg_move (ch_dlg, 3, 54);
printw (_("%6d of %d"), files_on_begin - (cpanel->marked) + 1, printw (_("%6d of %d"), files_on_begin - (current_panel->marked) + 1,
files_on_begin); files_on_begin);
} }
@ -539,7 +539,7 @@ init_chown_advanced (void)
sf_stat = g_new (struct stat, 1); sf_stat = g_new (struct stat, 1);
do_refresh (); do_refresh ();
end_chown = need_update = current_file = 0; end_chown = need_update = current_file = 0;
single_set = (cpanel->marked < 2) ? 2 : 0; single_set = (current_panel->marked < 2) ? 2 : 0;
memset (ch_flags, '=', 11); memset (ch_flags, '=', 11);
flag_pos = 0; flag_pos = 0;
x_toggle = 070; x_toggle = 070;
@ -582,17 +582,17 @@ chown_advanced_done (void)
#if 0 #if 0
static inline void do_chown (uid_t u, gid_t g) static inline void do_chown (uid_t u, gid_t g)
{ {
chown (cpanel->dir.list[current_file].fname, u, g); chown (current_panel->dir.list[current_file].fname, u, g);
file_mark (cpanel, current_file, 0); file_mark (current_panel, current_file, 0);
} }
#endif #endif
static char *next_file (void) static char *next_file (void)
{ {
while (!cpanel->dir.list[current_file].f.marked) while (!current_panel->dir.list[current_file].f.marked)
current_file++; current_file++;
return cpanel->dir.list[current_file].fname; return current_panel->dir.list[current_file].fname;
} }
static void apply_advanced_chowns (struct stat *sf) static void apply_advanced_chowns (struct stat *sf)
@ -601,7 +601,7 @@ static void apply_advanced_chowns (struct stat *sf)
gid_t a_gid = sf->st_gid; gid_t a_gid = sf->st_gid;
uid_t a_uid = sf->st_uid; uid_t a_uid = sf->st_uid;
fname = cpanel->dir.list[current_file].fname; fname = current_panel->dir.list[current_file].fname;
need_update = end_chown = 1; need_update = end_chown = 1;
if (mc_chmod (fname, get_mode ()) == -1) if (mc_chmod (fname, get_mode ()) == -1)
message (1, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
@ -611,7 +611,7 @@ static void apply_advanced_chowns (struct stat *sf)
(ch_flags[10] == '+') ? sf->st_gid : -1) == -1) (ch_flags[10] == '+') ? sf->st_gid : -1) == -1)
message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno)); fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0); do_file_mark (current_panel, current_file, 0);
do { do {
fname = next_file (); fname = next_file ();
@ -627,23 +627,23 @@ static void apply_advanced_chowns (struct stat *sf)
message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno)); fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0); do_file_mark (current_panel, current_file, 0);
} while (cpanel->marked); } while (current_panel->marked);
} }
void void
chown_advanced_cmd (void) chown_advanced_cmd (void)
{ {
files_on_begin = cpanel->marked; files_on_begin = current_panel->marked;
do { /* do while any files remaining */ do { /* do while any files remaining */
init_chown_advanced (); init_chown_advanced ();
if (cpanel->marked) if (current_panel->marked)
fname = next_file (); /* next marked file */ fname = next_file (); /* next marked file */
else else
fname = selection (cpanel)->fname; /* single file */ fname = selection (current_panel)->fname; /* single file */
if (mc_stat (fname, sf_stat) != 0) { /* get status of file */ if (mc_stat (fname, sf_stat) != 0) { /* get status of file */
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
@ -682,12 +682,12 @@ chown_advanced_cmd (void)
} }
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL) { if (current_panel->marked && ch_dlg->ret_value != B_CANCEL) {
do_file_mark (cpanel, current_file, 0); do_file_mark (current_panel, current_file, 0);
need_update = 1; need_update = 1;
} }
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown); } while (current_panel->marked && !end_chown);
chown_advanced_done (); chown_advanced_done ();
} }

View File

@ -189,7 +189,7 @@ init_chmod (void)
do_refresh (); do_refresh ();
end_chmod = c_file = need_update = 0; end_chmod = c_file = need_update = 0;
single_set = (cpanel->marked < 2) ? 2 : 0; single_set = (current_panel->marked < 2) ? 2 : 0;
ch_dlg = ch_dlg =
create_dlg (0, 0, 22 - single_set, 70, dialog_colors, create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
@ -227,21 +227,21 @@ static void chmod_done (void)
static char *next_file (void) static char *next_file (void)
{ {
while (!cpanel->dir.list[c_file].f.marked) while (!current_panel->dir.list[c_file].f.marked)
c_file++; c_file++;
return cpanel->dir.list[c_file].fname; return current_panel->dir.list[c_file].fname;
} }
static void do_chmod (struct stat *sf) static void do_chmod (struct stat *sf)
{ {
sf->st_mode &= and_mask; sf->st_mode &= and_mask;
sf->st_mode |= or_mask; sf->st_mode |= or_mask;
if (mc_chmod (cpanel->dir.list [c_file].fname, sf->st_mode) == -1) if (mc_chmod (current_panel->dir.list [c_file].fname, sf->st_mode) == -1)
message (1, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chmod \"%s\" \n %s "),
cpanel->dir.list [c_file].fname, unix_error_string (errno)); current_panel->dir.list [c_file].fname, unix_error_string (errno));
do_file_mark (cpanel, c_file, 0); do_file_mark (current_panel, c_file, 0);
} }
static void apply_mask (struct stat *sf) static void apply_mask (struct stat *sf)
@ -258,7 +258,7 @@ static void apply_mask (struct stat *sf)
c_stat = sf->st_mode; c_stat = sf->st_mode;
do_chmod (sf); do_chmod (sf);
} while (cpanel->marked); } while (current_panel->marked);
} }
void chmod_cmd (void) void chmod_cmd (void)
@ -271,10 +271,10 @@ void chmod_cmd (void)
do { /* do while any files remaining */ do { /* do while any files remaining */
ch_dlg = init_chmod (); ch_dlg = init_chmod ();
if (cpanel->marked) if (current_panel->marked)
fname = next_file (); /* next marked file */ fname = next_file (); /* next marked file */
else else
fname = selection (cpanel)->fname; /* single file */ fname = selection (current_panel)->fname; /* single file */
if (mc_stat (fname, &sf_stat) != 0) { /* get status of file */ if (mc_stat (fname, &sf_stat) != 0) { /* get status of file */
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
@ -358,12 +358,12 @@ void chmod_cmd (void)
break; break;
} }
if (cpanel->marked && ch_dlg->ret_value!=B_CANCEL) { if (current_panel->marked && ch_dlg->ret_value!=B_CANCEL) {
do_file_mark (cpanel, c_file, 0); do_file_mark (current_panel, c_file, 0);
need_update = 1; need_update = 1;
} }
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chmod); } while (current_panel->marked && !end_chmod);
chmod_done (); chmod_done ();
} }

View File

@ -122,10 +122,10 @@ chown_refresh (Dlg_head *h)
static char * static char *
next_file (void) next_file (void)
{ {
while (!cpanel->dir.list[current_file].f.marked) while (!current_panel->dir.list[current_file].f.marked)
current_file++; current_file++;
return cpanel->dir.list[current_file].fname; return current_panel->dir.list[current_file].fname;
} }
static cb_ret_t static cb_ret_t
@ -151,7 +151,7 @@ init_chown (void)
do_refresh (); do_refresh ();
end_chown = need_update = current_file = 0; end_chown = need_update = current_file = 0;
single_set = (cpanel->marked < 2) ? 3 : 0; single_set = (current_panel->marked < 2) ? 3 : 0;
ch_dlg = ch_dlg =
create_dlg (0, 0, 18, 74, dialog_colors, chown_callback, "[Chown]", create_dlg (0, 0, 18, 74, dialog_colors, chown_callback, "[Chown]",
@ -210,11 +210,11 @@ chown_done (void)
static inline void static inline void
do_chown (uid_t u, gid_t g) do_chown (uid_t u, gid_t g)
{ {
if (mc_chown (cpanel->dir.list [current_file].fname, u, g) == -1) if (mc_chown (current_panel->dir.list [current_file].fname, u, g) == -1)
message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
cpanel->dir.list [current_file].fname, unix_error_string (errno)); current_panel->dir.list [current_file].fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0); do_file_mark (current_panel, current_file, 0);
} }
static void static void
@ -229,7 +229,7 @@ apply_chowns (uid_t u, gid_t g)
fname = next_file (); fname = next_file ();
do_chown (u,g); do_chown (u,g);
} while (cpanel->marked); } while (current_panel->marked);
} }
#define chown_label(n,txt) label_set_text (chown_label [n].l, txt) #define chown_label(n,txt) label_set_text (chown_label [n].l, txt)
@ -249,10 +249,10 @@ chown_cmd (void)
ch_dlg = init_chown (); ch_dlg = init_chown ();
new_user = new_group = -1; new_user = new_group = -1;
if (cpanel->marked) if (current_panel->marked)
fname = next_file (); /* next marked file */ fname = next_file (); /* next marked file */
else else
fname = selection (cpanel)->fname; /* single file */ fname = selection (current_panel)->fname; /* single file */
if (mc_stat (fname, &sf_stat) != 0) { /* get status of file */ if (mc_stat (fname, &sf_stat) != 0) { /* get status of file */
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
@ -327,12 +327,12 @@ chown_cmd (void)
} }
} }
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL){ if (current_panel->marked && ch_dlg->ret_value != B_CANCEL){
do_file_mark (cpanel, current_file, 0); do_file_mark (current_panel, current_file, 0);
need_update = 1; need_update = 1;
} }
destroy_dlg (ch_dlg); destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown); } while (current_panel->marked && !end_chown);
chown_done (); chown_done ();
} }

View File

@ -55,7 +55,7 @@
#include "key.h" /* application_keypad_mode() */ #include "key.h" /* application_keypad_mode() */
#include "win.h" /* do_enter_ca_mode() */ #include "win.h" /* do_enter_ca_mode() */
#include "main.h" /* change_panel() */ #include "main.h" /* change_panel() */
#include "panel.h" /* cpanel */ #include "panel.h" /* current_panel */
#include "help.h" /* interactive_display() */ #include "help.h" /* interactive_display() */
#include "user.h" /* MC_GLOBAL_MENU */ #include "user.h" /* MC_GLOBAL_MENU */
#include "command.h" /* cmdline */ #include "command.h" /* cmdline */
@ -187,32 +187,32 @@ do_view_cmd (int normal)
int dir, file_idx; int dir, file_idx;
/* Directories are viewed by changing to them */ /* Directories are viewed by changing to them */
if (S_ISDIR (selection (cpanel)->st.st_mode) if (S_ISDIR (selection (current_panel)->st.st_mode)
|| link_isdir (selection (cpanel))) { || link_isdir (selection (current_panel))) {
if (confirm_view_dir && (cpanel->marked || cpanel->dirs_marked)) { if (confirm_view_dir && (current_panel->marked || current_panel->dirs_marked)) {
if (query_dialog if (query_dialog
(_(" Confirmation "), _("Files tagged, want to cd?"), 0, 2, (_(" Confirmation "), _("Files tagged, want to cd?"), 0, 2,
_("&Yes"), _("&No")) != 0) { _("&Yes"), _("&No")) != 0) {
return; return;
} }
} }
if (!do_cd (selection (cpanel)->fname, cd_exact)) if (!do_cd (selection (current_panel)->fname, cd_exact))
message (1, MSG_ERROR, _("Cannot change directory")); message (1, MSG_ERROR, _("Cannot change directory"));
return; return;
} }
file_idx = cpanel->selected; file_idx = current_panel->selected;
while (1) { while (1) {
char *filename; char *filename;
filename = cpanel->dir.list[file_idx].fname; filename = current_panel->dir.list[file_idx].fname;
dir = view_file (filename, normal, use_internal_view); dir = view_file (filename, normal, use_internal_view);
if (dir == 0) if (dir == 0)
break; break;
file_idx = scan_for_file (cpanel, file_idx, dir); file_idx = scan_for_file (current_panel, file_idx, dir);
} }
} }
@ -231,7 +231,7 @@ view_file_cmd (void)
filename = filename =
input_dialog (_(" View file "), _(" Filename:"), input_dialog (_(" View file "), _(" Filename:"),
selection (cpanel)->fname); selection (current_panel)->fname);
if (!filename) if (!filename)
return; return;
@ -254,7 +254,7 @@ filtered_view_cmd (void)
command = command =
input_dialog (_(" Filtered view "), input_dialog (_(" Filtered view "),
_(" Filter command and arguments:"), _(" Filter command and arguments:"),
selection (cpanel)->fname); selection (current_panel)->fname);
if (!command) if (!command)
return; return;
@ -294,8 +294,8 @@ do_edit (const char *what)
void void
edit_cmd (void) edit_cmd (void)
{ {
if (regex_command (selection (cpanel)->fname, "Edit", 0) == 0) if (regex_command (selection (current_panel)->fname, "Edit", 0) == 0)
do_edit (selection (cpanel)->fname); do_edit (selection (current_panel)->fname);
} }
void void
@ -309,7 +309,7 @@ void
copy_cmd (void) copy_cmd (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_COPY, 0)) { if (panel_operate (current_panel, OP_COPY, 0)) {
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -319,7 +319,7 @@ copy_cmd (void)
void ren_cmd (void) void ren_cmd (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_MOVE, 0)){ if (panel_operate (current_panel, OP_MOVE, 0)){
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -329,7 +329,7 @@ void ren_cmd (void)
void copy_cmd_local (void) void copy_cmd_local (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_COPY, 1)){ if (panel_operate (current_panel, OP_COPY, 1)){
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -339,7 +339,7 @@ void copy_cmd_local (void)
void ren_cmd_local (void) void ren_cmd_local (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_MOVE, 1)){ if (panel_operate (current_panel, OP_MOVE, 1)){
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -361,14 +361,14 @@ mkdir_cmd (void)
if (dir[0] == '/' || dir[0] == '~') if (dir[0] == '/' || dir[0] == '~')
tempdir = g_strdup (dir); tempdir = g_strdup (dir);
else else
tempdir = concat_dir_and_file (cpanel->cwd, dir); tempdir = concat_dir_and_file (current_panel->cwd, dir);
g_free (dir); g_free (dir);
save_cwds_stat (); save_cwds_stat ();
if (my_mkdir (tempdir, 0777) == 0) { if (my_mkdir (tempdir, 0777) == 0) {
update_panels (UP_OPTIMIZE, tempdir); update_panels (UP_OPTIMIZE, tempdir);
repaint_screen (); repaint_screen ();
select_item (cpanel); select_item (current_panel);
g_free (tempdir); g_free (tempdir);
return; return;
} }
@ -380,7 +380,7 @@ void delete_cmd (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_DELETE, 0)){ if (panel_operate (current_panel, OP_DELETE, 0)){
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -391,7 +391,7 @@ void delete_cmd_local (void)
{ {
save_cwds_stat (); save_cwds_stat ();
if (panel_operate (cpanel, OP_DELETE, 1)){ if (panel_operate (current_panel, OP_DELETE, 1)){
update_panels (UP_OPTIMIZE, UP_KEEPSEL); update_panels (UP_OPTIMIZE, UP_KEEPSEL);
repaint_screen (); repaint_screen ();
} }
@ -451,7 +451,7 @@ void reread_cmd (void)
if (get_current_type () == view_listing && if (get_current_type () == view_listing &&
get_other_type () == view_listing) get_other_type () == view_listing)
flag = strcmp (cpanel->cwd, opanel->cwd) ? UP_ONLY_CURRENT : 0; flag = strcmp (current_panel->cwd, other_panel->cwd) ? UP_ONLY_CURRENT : 0;
else else
flag = UP_ONLY_CURRENT; flag = UP_ONLY_CURRENT;
@ -464,11 +464,11 @@ void reverse_selection_cmd (void)
file_entry *file; file_entry *file;
int i; int i;
for (i = 0; i < cpanel->count; i++){ for (i = 0; i < current_panel->count; i++){
file = &cpanel->dir.list [i]; file = &current_panel->dir.list [i];
if (S_ISDIR (file->st.st_mode)) if (S_ISDIR (file->st.st_mode))
continue; continue;
do_file_mark (cpanel, i, !file->f.marked); do_file_mark (current_panel, i, !file->f.marked);
} }
} }
@ -495,24 +495,24 @@ void select_cmd (void)
reg_exp_t [strlen(reg_exp_t) - 1] = 0; reg_exp_t [strlen(reg_exp_t) - 1] = 0;
} }
for (i = 0; i < cpanel->count; i++){ for (i = 0; i < current_panel->count; i++){
if (!strcmp (cpanel->dir.list [i].fname, "..")) if (!strcmp (current_panel->dir.list [i].fname, ".."))
continue; continue;
if (S_ISDIR (cpanel->dir.list [i].st.st_mode)){ if (S_ISDIR (current_panel->dir.list [i].st.st_mode)){
if (!dirflag) if (!dirflag)
continue; continue;
} else { } else {
if (dirflag) if (dirflag)
continue; continue;
} }
c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file); c = regexp_match (reg_exp_t, current_panel->dir.list [i].fname, match_file);
if (c == -1){ if (c == -1){
message (1, MSG_ERROR, _(" Malformed regular expression ")); message (1, MSG_ERROR, _(" Malformed regular expression "));
g_free (reg_exp); g_free (reg_exp);
return; return;
} }
if (c){ if (c){
do_file_mark (cpanel, i, 1); do_file_mark (current_panel, i, 1);
} }
} }
g_free (reg_exp); g_free (reg_exp);
@ -540,24 +540,24 @@ void unselect_cmd (void)
dirflag = 1; dirflag = 1;
reg_exp_t [strlen(reg_exp_t) - 1] = 0; reg_exp_t [strlen(reg_exp_t) - 1] = 0;
} }
for (i = 0; i < cpanel->count; i++){ for (i = 0; i < current_panel->count; i++){
if (!strcmp (cpanel->dir.list [i].fname, "..")) if (!strcmp (current_panel->dir.list [i].fname, ".."))
continue; continue;
if (S_ISDIR (cpanel->dir.list [i].st.st_mode)){ if (S_ISDIR (current_panel->dir.list [i].st.st_mode)){
if (!dirflag) if (!dirflag)
continue; continue;
} else { } else {
if (dirflag) if (dirflag)
continue; continue;
} }
c = regexp_match (reg_exp_t, cpanel->dir.list [i].fname, match_file); c = regexp_match (reg_exp_t, current_panel->dir.list [i].fname, match_file);
if (c == -1){ if (c == -1){
message (1, MSG_ERROR, _(" Malformed regular expression ")); message (1, MSG_ERROR, _(" Malformed regular expression "));
g_free (reg_exp); g_free (reg_exp);
return; return;
} }
if (c){ if (c){
do_file_mark (cpanel, i, 0); do_file_mark (current_panel, i, 0);
} }
} }
g_free (reg_exp); g_free (reg_exp);
@ -862,8 +862,8 @@ compare_dirs_cmd (void)
if (get_current_type () == view_listing if (get_current_type () == view_listing
&& get_other_type () == view_listing) { && get_other_type () == view_listing) {
compare_dir (cpanel, opanel, thorough_flag); compare_dir (current_panel, other_panel, thorough_flag);
compare_dir (opanel, cpanel, thorough_flag); compare_dir (other_panel, current_panel, thorough_flag);
} else { } else {
message (1, MSG_ERROR, message (1, MSG_ERROR,
_(" Both panels should be in the " _(" Both panels should be in the "
@ -954,10 +954,10 @@ do_link (int symbolic_link, char *fname)
char *d; char *d;
/* suggest the full path for symlink */ /* suggest the full path for symlink */
s = concat_dir_and_file (cpanel->cwd, fname); s = concat_dir_and_file (current_panel->cwd, fname);
if (get_other_type () == view_listing) { if (get_other_type () == view_listing) {
d = concat_dir_and_file (opanel->cwd, fname); d = concat_dir_and_file (other_panel->cwd, fname);
} else { } else {
d = g_strdup (fname); d = g_strdup (fname);
} }
@ -986,13 +986,13 @@ do_link (int symbolic_link, char *fname)
void link_cmd (void) void link_cmd (void)
{ {
do_link (0, selection (cpanel)->fname); do_link (0, selection (current_panel)->fname);
} }
void symlink_cmd (void) void symlink_cmd (void)
{ {
char *filename = NULL; char *filename = NULL;
filename = selection (cpanel)->fname; filename = selection (current_panel)->fname;
if (filename) { if (filename) {
do_link (1, filename); do_link (1, filename);
@ -1001,13 +1001,13 @@ void symlink_cmd (void)
void edit_symlink_cmd (void) void edit_symlink_cmd (void)
{ {
if (S_ISLNK (selection (cpanel)->st.st_mode)) { if (S_ISLNK (selection (current_panel)->st.st_mode)) {
char buffer [MC_MAXPATHLEN]; char buffer [MC_MAXPATHLEN];
char *p = NULL; char *p = NULL;
int i; int i;
char *dest, *q; char *dest, *q;
p = selection (cpanel)->fname; p = selection (current_panel)->fname;
q = g_strdup_printf (_(" Symlink `%s\' points to: "), name_trunc (p, 32)); q = g_strdup_printf (_(" Symlink `%s\' points to: "), name_trunc (p, 32));
@ -1035,7 +1035,7 @@ void edit_symlink_cmd (void)
g_free (q); g_free (q);
} else { } else {
message (1, MSG_ERROR, _("`%s' is not a symbolic link"), message (1, MSG_ERROR, _("`%s' is not a symbolic link"),
selection (cpanel)->fname); selection (current_panel)->fname);
} }
} }
@ -1219,7 +1219,7 @@ void quick_cd_cmd (void)
void void
dirsizes_cmd (void) dirsizes_cmd (void)
{ {
WPanel *panel = cpanel; WPanel *panel = current_panel;
int i; int i;
off_t marked; off_t marked;
double total; double total;
@ -1284,7 +1284,7 @@ info_cmd_no_menu (void)
else if (get_display_type (1) == view_info) else if (get_display_type (1) == view_info)
set_display_type (1, view_listing); set_display_type (1, view_listing);
else else
set_display_type (cpanel == left_panel ? 1 : 0, view_info); set_display_type (current_panel == left_panel ? 1 : 0, view_info);
} }
void void
@ -1295,7 +1295,7 @@ quick_cmd_no_menu (void)
else if (get_display_type (1) == view_quick) else if (get_display_type (1) == view_quick)
set_display_type (1, view_listing); set_display_type (1, view_listing);
else else
set_display_type (cpanel == left_panel ? 1 : 0, view_quick); set_display_type (current_panel == left_panel ? 1 : 0, view_quick);
} }
static void static void
@ -1346,7 +1346,7 @@ info_cmd (void)
void void
quick_view_cmd (void) quick_view_cmd (void)
{ {
if ((WPanel *) get_panel_widget (MENU_PANEL_IDX) == cpanel) if ((WPanel *) get_panel_widget (MENU_PANEL_IDX) == current_panel)
change_panel (); change_panel ();
set_display_type (MENU_PANEL_IDX, view_quick); set_display_type (MENU_PANEL_IDX, view_quick);
} }

View File

@ -146,7 +146,7 @@ void do_cd_command (char *cmd)
if (cmd [0] == 0){ if (cmd [0] == 0){
sync_tree (home_dir); sync_tree (home_dir);
} else if (strcmp (cmd+3, "..") == 0){ } else if (strcmp (cmd+3, "..") == 0){
char *dir = cpanel->cwd; char *dir = current_panel->cwd;
int len = strlen (dir); int len = strlen (dir);
while (len && dir [--len] != PATH_SEP); while (len && dir [--len] != PATH_SEP);
dir [len] = 0; dir [len] = 0;
@ -157,7 +157,7 @@ void do_cd_command (char *cmd)
} else if (cmd [3] == PATH_SEP){ } else if (cmd [3] == PATH_SEP){
sync_tree (cmd+3); sync_tree (cmd+3);
} else { } else {
char *old = cpanel->cwd; char *old = current_panel->cwd;
char *new; char *new;
new = concat_dir_and_file (old, cmd+3); new = concat_dir_and_file (old, cmd+3);
sync_tree (new); sync_tree (new);

View File

@ -658,7 +658,7 @@ regex_command (char *filename, char *action, int *move_dir)
* We need to copy the filename because exec_extension * We need to copy the filename because exec_extension
* may end up invoking update_panels thus making the * may end up invoking update_panels thus making the
* filename parameter invalid (ie, most of the time, * filename parameter invalid (ie, most of the time,
* we get filename as a pointer from cpanel->dir). * we get filename as a pointer from current_panel->dir).
*/ */
if (p < q) { if (p < q) {
char *filename_copy = g_strdup (filename); char *filename_copy = g_strdup (filename);

View File

@ -1847,7 +1847,7 @@ panel_operate (void *source_panel, FileOperation operation,
if (force_single) if (force_single)
dest_dir = source; dest_dir = source;
else if (get_other_type () == view_listing) else if (get_other_type () == view_listing)
dest_dir = opanel->cwd; dest_dir = other_panel->cwd;
else else
dest_dir = panel->cwd; dest_dir = panel->cwd;

View File

@ -65,7 +65,7 @@
#define WANT_WIDGETS #define WANT_WIDGETS
#include "main.h" /* the_hint */ #include "main.h" /* the_hint */
#include "wtools.h" /* QuickDialog */ #include "wtools.h" /* QuickDialog */
#include "panel.h" /* cpanel */ #include "panel.h" /* current_panel */
#include "fileopctx.h" /* FILE_CONT */ #include "fileopctx.h" /* FILE_CONT */
#include "filegui.h" #include "filegui.h"
#include "key.h" /* get_event */ #include "key.h" /* get_event */
@ -442,10 +442,10 @@ file_progress_show_source (FileOpContext *ctx, char *s)
if (s != NULL) { if (s != NULL) {
#ifdef WITH_FULL_PATHS #ifdef WITH_FULL_PATHS
int i = strlen (cpanel->cwd); int i = strlen (current_panel->cwd);
/* We remove the full path we have added before */ /* We remove the full path we have added before */
if (!strncmp (s, cpanel->cwd, i)) { if (!strncmp (s, current_panel->cwd, i)) {
if (s[i] == PATH_SEP) if (s[i] == PATH_SEP)
s += i + 1; s += i + 1;
} }

View File

@ -266,7 +266,7 @@ find_parameters (char **start_dir, char **pattern, char **content)
g_free (in_start_dir); g_free (in_start_dir);
if (strcmp (temp_dir, ".") == 0) { if (strcmp (temp_dir, ".") == 0) {
g_free (temp_dir); g_free (temp_dir);
temp_dir = g_strdup (cpanel->cwd); temp_dir = g_strdup (current_panel->cwd);
} }
in_start_dir = tree_box (temp_dir); in_start_dir = tree_box (temp_dir);
if (in_start_dir) if (in_start_dir)
@ -892,7 +892,7 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname,
int i; int i;
struct stat st; struct stat st;
WLEntry *entry = find_list->list; WLEntry *entry = find_list->list;
dir_list *list = &cpanel->dir; dir_list *list = &current_panel->dir;
char *dir, *name; char *dir, *name;
for (i = 0; entry && i < find_list->count; for (i = 0; entry && i < find_list->count;
@ -935,7 +935,7 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname,
} }
if (!next_free) /* first turn i.e clean old list */ if (!next_free) /* first turn i.e clean old list */
panel_clean_dir (cpanel); panel_clean_dir (current_panel);
list->list[next_free].fnamelen = strlen (name); list->list[next_free].fnamelen = strlen (name);
list->list[next_free].fname = name; list->list[next_free].fname = name;
list->list[next_free].f.marked = 0; list->list[next_free].f.marked = 0;
@ -948,17 +948,17 @@ find_file (char *start_dir, char *pattern, char *content, char **dirname,
rotate_dash (); rotate_dash ();
} }
if (next_free) { if (next_free) {
cpanel->count = next_free; current_panel->count = next_free;
cpanel->is_panelized = 1; current_panel->is_panelized = 1;
/* Done by panel_clean_dir a few lines above /* Done by panel_clean_dir a few lines above
cpanel->dirs_marked = 0; current_panel->dirs_marked = 0;
cpanel->marked = 0; current_panel->marked = 0;
cpanel->total = 0; current_panel->total = 0;
cpanel->top_file = 0; current_panel->top_file = 0;
cpanel->selected = 0; */ current_panel->selected = 0; */
if (start_dir[0] == PATH_SEP) { if (start_dir[0] == PATH_SEP) {
strcpy (cpanel->cwd, PATH_SEP_STR); strcpy (current_panel->cwd, PATH_SEP_STR);
chdir (PATH_SEP_STR); chdir (PATH_SEP_STR);
} }
} }
@ -996,11 +996,11 @@ do_find (void)
if (dirname){ if (dirname){
do_cd (dirname, cd_exact); do_cd (dirname, cd_exact);
if (filename) if (filename)
try_to_select (cpanel, filename + (content ? try_to_select (current_panel, filename + (content ?
(strchr (filename + 4, ':') - filename + 1) : 4) ); (strchr (filename + 4, ':') - filename + 1) : 4) );
} else if (filename) } else if (filename)
do_cd (filename, cd_exact); do_cd (filename, cd_exact);
select_item (cpanel); select_item (current_panel);
} }
if (dirname) if (dirname)
g_free (dirname); g_free (dirname);
@ -1018,8 +1018,8 @@ do_find (void)
if (v == B_PANELIZE){ if (v == B_PANELIZE){
if (dir_and_file_set){ if (dir_and_file_set){
try_to_select (cpanel, NULL); try_to_select (current_panel, NULL);
panel_re_sort (cpanel); panel_re_sort (current_panel);
} }
break; break;
} }

View File

@ -44,7 +44,7 @@
#include "setup.h" /* For profile_bname */ #include "setup.h" /* For profile_bname */
#include "profile.h" /* Load/save directories hotlist */ #include "profile.h" /* Load/save directories hotlist */
#include "wtools.h" /* QuickDialog */ #include "wtools.h" /* QuickDialog */
#include "panel.h" /* cpanel */ #include "panel.h" /* current_panel */
#include "main.h" /* repaint_screen */ #include "main.h" /* repaint_screen */
#include "hotlist.h" #include "hotlist.h"
#include "key.h" /* KEY_M_CTRL */ #include "key.h" /* KEY_M_CTRL */
@ -901,7 +901,7 @@ static void add_new_entry_cmd (void)
int ret; int ret;
/* Take current directory as default value for input fields */ /* Take current directory as default value for input fields */
title = url = cpanel->cwd; title = url = current_panel->cwd;
ret = add_new_entry_input (_("New hotlist entry"), _("Directory label"), _("Directory path"), ret = add_new_entry_input (_("New hotlist entry"), _("Directory label"), _("Directory path"),
"[Hotlist]", &title, &url); "[Hotlist]", &title, &url);
@ -1001,13 +1001,13 @@ void add2hotlist_cmd (void)
char *cp = _("Label for \"%s\":"); char *cp = _("Label for \"%s\":");
int l = strlen (cp); int l = strlen (cp);
prompt = g_strdup_printf (cp, name_trunc (cpanel->cwd, COLS-2*UX-(l+8))); prompt = g_strdup_printf (cp, name_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
label = input_dialog (_(" Add to hotlist "), prompt, cpanel->cwd); label = input_dialog (_(" Add to hotlist "), prompt, current_panel->cwd);
g_free (prompt); g_free (prompt);
if (!label || !*label) if (!label || !*label)
return; return;
add2hotlist (label,g_strdup (cpanel->cwd), HL_TYPE_ENTRY, 0); add2hotlist (label,g_strdup (current_panel->cwd), HL_TYPE_ENTRY, 0);
hotlist_state.modified = 1; hotlist_state.modified = 1;
} }

View File

@ -29,7 +29,7 @@
#include "info.h" #include "info.h"
#include "dir.h" /* required by panel */ #include "dir.h" /* required by panel */
#include "panel.h" /* for the panel structure */ #include "panel.h" /* for the panel structure */
#include "main.h" /* opanel, cpanel definitions */ #include "main.h" /* other_panel, current_panel definitions */
#include "util.h" /* size_trunc_len */ #include "util.h" /* size_trunc_len */
#include "layout.h" #include "layout.h"
#include "key.h" /* is_idle() */ #include "key.h" /* is_idle() */
@ -81,8 +81,8 @@ info_show_info (struct WInfo *info)
if (!info->ready) if (!info->ready)
return; return;
my_statfs (&myfs_stats, cpanel->cwd); my_statfs (&myfs_stats, current_panel->cwd);
st = cpanel->dir.list [cpanel->selected].st; st = current_panel->dir.list [current_panel->selected].st;
/* Print only lines which fit */ /* Print only lines which fit */
@ -188,9 +188,9 @@ info_show_info (struct WInfo *info)
case 3: case 3:
widget_move (&info->widget, 3, 2); widget_move (&info->widget, 3, 2);
/* .ado: fname is invalid if selected == 0 && info called from current panel */ /* .ado: fname is invalid if selected == 0 && info called from current panel */
if (cpanel->selected){ if (current_panel->selected){
printw (file_label, printw (file_label,
name_trunc (cpanel->dir.list [cpanel->selected].fname, name_trunc (current_panel->dir.list [current_panel->selected].fname,
info->widget.cols - i18n_adjust)); info->widget.cols - i18n_adjust));
} else } else
printw (_("File: None")); printw (_("File: None"));

View File

@ -990,11 +990,11 @@ void set_display_type (int num, int type)
* - select left panel * - select left panel
* - invoke menue left/tree * - invoke menue left/tree
* - as long as you stay in the left panel almost everything that uses * - as long as you stay in the left panel almost everything that uses
* cpanel causes segfault, e.g. C-Enter, C-x c, ... * current_panel causes segfault, e.g. C-Enter, C-x c, ...
*/ */
if (type != view_listing) if (type != view_listing)
if (cpanel == (WPanel *) old_widget) if (current_panel == (WPanel *) old_widget)
current_panel = num == 0 ? right_panel : left_panel; current_panel = num == 0 ? right_panel : left_panel;
} }
@ -1033,7 +1033,7 @@ void swap_panels ()
panel1->searching = 0; panel1->searching = 0;
panel2->searching = 0; panel2->searching = 0;
if (cpanel == panel1) if (current_panel == panel1)
current_panel = panel2; current_panel = panel2;
else else
current_panel = panel1; current_panel = panel1;
@ -1098,7 +1098,7 @@ get_panel_widget (int index)
int get_current_index (void) int get_current_index (void)
{ {
if (panels [0].widget == ((Widget *) cpanel)) if (panels [0].widget == ((Widget *) current_panel))
return 0; return 0;
else else
return 1; return 1;
@ -1118,7 +1118,7 @@ get_other_panel (void)
/* Returns the view type for the current panel/view */ /* Returns the view type for the current panel/view */
int get_current_type (void) int get_current_type (void)
{ {
if (panels [0].widget == (Widget *) cpanel) if (panels [0].widget == (Widget *) current_panel)
return panels [0].type; return panels [0].type;
else else
return panels [1].type; return panels [1].type;
@ -1127,7 +1127,7 @@ int get_current_type (void)
/* Returns the view type of the unselected panel */ /* Returns the view type of the unselected panel */
int get_other_type (void) int get_other_type (void)
{ {
if (panels [0].widget == (Widget *) cpanel) if (panels [0].widget == (Widget *) current_panel)
return panels [1].type; return panels [1].type;
else else
return panels [0].type; return panels [0].type;

View File

@ -282,7 +282,7 @@ reload_panelized (WPanel *panel)
int i, j; int i, j;
dir_list *list = &panel->dir; dir_list *list = &panel->dir;
if (panel != cpanel) if (panel != current_panel)
mc_chdir (panel->cwd); mc_chdir (panel->cwd);
for (i = 0, j = 0; i < panel->count; i++) { for (i = 0, j = 0; i < panel->count; i++) {
@ -310,8 +310,8 @@ reload_panelized (WPanel *panel)
else else
panel->count = j; panel->count = j;
if (panel != cpanel) if (panel != current_panel)
mc_chdir (cpanel->cwd); mc_chdir (current_panel->cwd);
} }
static void static void
@ -407,9 +407,9 @@ void
save_cwds_stat (void) save_cwds_stat (void)
{ {
if (fast_reload) { if (fast_reload) {
mc_stat (cpanel->cwd, &(cpanel->dir_stat)); mc_stat (current_panel->cwd, &(current_panel->dir_stat));
if (get_other_type () == view_listing) if (get_other_type () == view_listing)
mc_stat (opanel->cwd, &(opanel->dir_stat)); mc_stat (other_panel->cwd, &(other_panel->dir_stat));
} }
} }
@ -628,7 +628,7 @@ do_panel_cd (struct WPanel *panel, char *new_dir, enum cd_enum cd_type)
int int
do_cd (char *new_dir, enum cd_enum exact) do_cd (char *new_dir, enum cd_enum exact)
{ {
return (do_panel_cd (cpanel, new_dir, exact)); return (do_panel_cd (current_panel, new_dir, exact));
} }
void void
@ -724,9 +724,9 @@ maybe_cd (int char_code, int move_up_dir)
do_cd ("..", cd_exact); do_cd ("..", cd_exact);
return 1; return 1;
} }
if (S_ISDIR (selection (cpanel)->st.st_mode) if (S_ISDIR (selection (current_panel)->st.st_mode)
|| link_isdir (selection (cpanel))) { || link_isdir (selection (current_panel))) {
do_cd (selection (cpanel)->fname, cd_exact); do_cd (selection (current_panel)->fname, cd_exact);
return 1; return 1;
} }
} }
@ -755,7 +755,7 @@ treebox_cmd (void)
{ {
char *sel_dir; char *sel_dir;
sel_dir = tree_box (selection (cpanel)->fname); sel_dir = tree_box (selection (current_panel)->fname);
if (sel_dir) { if (sel_dir) {
do_cd (sel_dir, cd_exact); do_cd (sel_dir, cd_exact);
g_free (sel_dir); g_free (sel_dir);
@ -771,14 +771,14 @@ listmode_cmd (void)
if (get_current_type () != view_listing) if (get_current_type () != view_listing)
return; return;
newmode = listmode_edit (cpanel->user_format); newmode = listmode_edit (current_panel->user_format);
if (!newmode) if (!newmode)
return; return;
g_free (cpanel->user_format); g_free (current_panel->user_format);
cpanel->list_type = list_user; current_panel->list_type = list_user;
cpanel->user_format = newmode; current_panel->user_format = newmode;
set_panel_formats (cpanel); set_panel_formats (current_panel);
do_refresh (); do_refresh ();
} }
@ -962,7 +962,7 @@ menu_cmd (void)
if (the_menubar->active) if (the_menubar->active)
return; return;
if ((get_current_index () == 0) ^ (!cpanel->active)) if ((get_current_index () == 0) ^ (!current_panel->active))
the_menubar->selected = 0; the_menubar->selected = 0;
else else
the_menubar->selected = 4; the_menubar->selected = 4;
@ -1092,8 +1092,8 @@ copy_current_pathname (void)
if (!command_prompt) if (!command_prompt)
return; return;
command_insert (cmdline, cpanel->cwd, 0); command_insert (cmdline, current_panel->cwd, 0);
if (cpanel->cwd[strlen (cpanel->cwd) - 1] != PATH_SEP) if (current_panel->cwd[strlen (current_panel->cwd) - 1] != PATH_SEP)
command_insert (cmdline, PATH_SEP_STR, 0); command_insert (cmdline, PATH_SEP_STR, 0);
} }
@ -1106,8 +1106,8 @@ copy_other_pathname (void)
if (!command_prompt) if (!command_prompt)
return; return;
command_insert (cmdline, opanel->cwd, 0); command_insert (cmdline, other_panel->cwd, 0);
if (opanel->cwd[strlen (opanel->cwd) - 1] != PATH_SEP) if (other_panel->cwd[strlen (other_panel->cwd) - 1] != PATH_SEP)
command_insert (cmdline, PATH_SEP_STR, 0); command_insert (cmdline, PATH_SEP_STR, 0);
} }
@ -1134,7 +1134,7 @@ copy_readlink (WPanel *panel)
static void static void
copy_current_readlink (void) copy_current_readlink (void)
{ {
copy_readlink (cpanel); copy_readlink (current_panel);
} }
static void static void
@ -1142,7 +1142,7 @@ copy_other_readlink (void)
{ {
if (get_other_type () != view_listing) if (get_other_type () != view_listing)
return; return;
copy_readlink (opanel); copy_readlink (other_panel);
} }
/* Insert the selected file name into the input line */ /* Insert the selected file name into the input line */
@ -1157,7 +1157,7 @@ copy_prog_name (void)
WTree *tree = (WTree *) get_panel_widget (get_current_index ()); WTree *tree = (WTree *) get_panel_widget (get_current_index ());
tmp = tree_selected_name (tree); tmp = tree_selected_name (tree);
} else } else
tmp = selection (cpanel)->fname; tmp = selection (current_panel)->fname;
command_insert (cmdline, tmp, 1); command_insert (cmdline, tmp, 1);
} }
@ -1185,7 +1185,7 @@ copy_tagged (WPanel *panel)
static void static void
copy_current_tagged (void) copy_current_tagged (void)
{ {
copy_tagged (cpanel); copy_tagged (current_panel);
} }
static void static void
@ -1193,7 +1193,7 @@ copy_other_tagged (void)
{ {
if (get_other_type () != view_listing) if (get_other_type () != view_listing)
return; return;
copy_tagged (opanel); copy_tagged (other_panel);
} }
static void static void
@ -1406,10 +1406,10 @@ setup_dummy_mc (const char *file)
/* Create a fake current_panel, this is needed because the /* Create a fake current_panel, this is needed because the
* expand_format routine will use current panel. * expand_format routine will use current panel.
*/ */
strcpy (cpanel->cwd, d); strcpy (current_panel->cwd, d);
cpanel->selected = 0; current_panel->selected = 0;
cpanel->count = 1; current_panel->count = 1;
cpanel->dir.list[0].fname = (char *) file; current_panel->dir.list[0].fname = (char *) file;
} }
static void static void
@ -1495,7 +1495,7 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
} }
if ((!alternate_plus_minus || !(console_flag || xterm_flag)) if ((!alternate_plus_minus || !(console_flag || xterm_flag))
&& !quote && !cpanel->searching) { && !quote && !current_panel->searching) {
if (!only_leading_plus_minus) { if (!only_leading_plus_minus) {
/* Special treatement, since the input line will eat them */ /* Special treatement, since the input line will eat them */
if (parm == '+') { if (parm == '+') {
@ -1536,9 +1536,9 @@ midnight_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
return MSG_NOT_HANDLED; return MSG_NOT_HANDLED;
case DLG_HOTKEY_HANDLED: case DLG_HOTKEY_HANDLED:
if ((get_current_type () == view_listing) && cpanel->searching) { if ((get_current_type () == view_listing) && current_panel->searching) {
cpanel->searching = 0; current_panel->searching = 0;
cpanel->dirty = 1; current_panel->dirty = 1;
} }
return MSG_HANDLED; return MSG_HANDLED;
@ -1594,7 +1594,7 @@ update_xterm_title_path (void)
unsigned char *p, *s; unsigned char *p, *s;
if (xterm_flag && xterm_title) { if (xterm_flag && xterm_title) {
p = s = g_strdup (strip_home_and_password (cpanel->cwd)); p = s = g_strdup (strip_home_and_password (current_panel->cwd));
do { do {
if (!is_printable (*s)) if (!is_printable (*s))
*s = '?'; *s = '?';
@ -1734,9 +1734,9 @@ do_nc (void)
/* Program end */ /* Program end */
midnight_shutdown = 1; midnight_shutdown = 1;
/* destroy_dlg destroys even cpanel->cwd, so we have to save a copy :) */ /* destroy_dlg destroys even current_panel->cwd, so we have to save a copy :) */
if (last_wd_file && vfs_current_is_local ()) { if (last_wd_file && vfs_current_is_local ()) {
last_wd_string = g_strdup (cpanel->cwd); last_wd_string = g_strdup (current_panel->cwd);
} }
done_mc (); done_mc ();

View File

@ -91,9 +91,6 @@ void update_dirty_panels (void);
void panel_update_cols (Widget *widget, int frame_size); void panel_update_cols (Widget *widget, int frame_size);
int set_panel_formats (WPanel *p); int set_panel_formats (WPanel *p);
/* Useful macros to avoid too much typing */
#define cpanel current_panel
#define opanel get_other_panel()
#define other_panel get_other_panel() #define other_panel get_other_panel()
extern WPanel *left_panel; extern WPanel *left_panel;

View File

@ -39,7 +39,7 @@
#include "setup.h" /* For profile_bname */ #include "setup.h" /* For profile_bname */
#include "profile.h" /* Load/save directories panelize */ #include "profile.h" /* Load/save directories panelize */
#include "dir.h" #include "dir.h"
#include "panel.h" /* cpanel */ #include "panel.h" /* current_panel */
#include "main.h" /* repaint_screen */ #include "main.h" /* repaint_screen */
#include "panelize.h" #include "panelize.h"
@ -358,7 +358,7 @@ static void do_external_panelize (char *command)
int status, link_to_dir, stale_link; int status, link_to_dir, stale_link;
int next_free = 0; int next_free = 0;
struct stat st; struct stat st;
dir_list *list = &cpanel->dir; dir_list *list = &current_panel->dir;
char line [MC_MAXPATHLEN]; char line [MC_MAXPATHLEN];
char *name; char *name;
FILE *external; FILE *external;
@ -370,7 +370,7 @@ static void do_external_panelize (char *command)
return; return;
} }
/* Clear the counters and the directory list */ /* Clear the counters and the directory list */
panel_clean_dir (cpanel); panel_clean_dir (current_panel);
while (1) { while (1) {
clearerr(external); clearerr(external);
@ -396,7 +396,7 @@ static void do_external_panelize (char *command)
break; break;
list->list [next_free].fnamelen = strlen (name); list->list [next_free].fnamelen = strlen (name);
list->list [next_free].fname = g_strdup (name); list->list [next_free].fname = g_strdup (name);
file_mark (cpanel, next_free, 0); file_mark (current_panel, next_free, 0);
list->list [next_free].f.link_to_dir = link_to_dir; list->list [next_free].f.link_to_dir = link_to_dir;
list->list [next_free].f.stale_link = stale_link; list->list [next_free].f.stale_link = stale_link;
list->list [next_free].f.dir_size_computed = 0; list->list [next_free].f.dir_size_computed = 0;
@ -406,19 +406,19 @@ static void do_external_panelize (char *command)
rotate_dash (); rotate_dash ();
} }
cpanel->is_panelized = 1; current_panel->is_panelized = 1;
if (next_free){ if (next_free){
cpanel->count = next_free; current_panel->count = next_free;
if (list->list [0].fname [0] == PATH_SEP){ if (list->list [0].fname [0] == PATH_SEP){
strcpy (cpanel->cwd, PATH_SEP_STR); strcpy (current_panel->cwd, PATH_SEP_STR);
chdir (PATH_SEP_STR); chdir (PATH_SEP_STR);
} }
} else { } else {
cpanel->count = set_zero_dir (list); current_panel->count = set_zero_dir (list);
} }
if (pclose (external) < 0) if (pclose (external) < 0)
message (0, _("External panelize"), _("Pipe close failed")); message (0, _("External panelize"), _("Pipe close failed"));
close_error_pipe (0, 0); close_error_pipe (0, 0);
try_to_select (cpanel, NULL); try_to_select (current_panel, NULL);
panel_re_sort (cpanel); panel_re_sort (current_panel);
} }

View File

@ -808,11 +808,11 @@ paint_panel (WPanel *panel)
void void
update_dirty_panels (void) update_dirty_panels (void)
{ {
if (cpanel->dirty) if (current_panel->dirty)
panel_update_contents (cpanel); panel_update_contents (current_panel);
if ((get_other_type () == view_listing) && opanel->dirty) if ((get_other_type () == view_listing) && other_panel->dirty)
panel_update_contents (opanel); panel_update_contents (other_panel);
} }
static void static void
@ -1939,7 +1939,7 @@ do_enter_on_file_entry (file_entry *fe)
return 1; return 1;
/* Check if the file is executable */ /* Check if the file is executable */
full_name = concat_dir_and_file (cpanel->cwd, fe->fname); full_name = concat_dir_and_file (current_panel->cwd, fe->fname);
if (!is_exe (fe->st.st_mode) || !if_link_is_exe (full_name, fe)) { if (!is_exe (fe->st.st_mode) || !if_link_is_exe (full_name, fe)) {
g_free (full_name); g_free (full_name);
return 0; return 0;
@ -1997,7 +1997,7 @@ chdir_other_panel (WPanel *panel)
set_display_type (get_other_index (), view_listing); set_display_type (get_other_index (), view_listing);
} }
do_panel_cd (opanel, cpanel->cwd, cd_exact); do_panel_cd (other_panel, current_panel->cwd, cd_exact);
/* try to select current filename on the other panel */ /* try to select current filename on the other panel */
if (!panel->is_panelized) { if (!panel->is_panelized) {

View File

@ -327,7 +327,7 @@ save_setup (void)
save_layout (); save_layout ();
save_string ("Dirs", "other_dir", save_string ("Dirs", "other_dir",
get_other_type () == view_listing get_other_type () == view_listing
? opanel->cwd : ".", profile); ? other_panel->cwd : ".", profile);
if (current_panel != NULL) if (current_panel != NULL)
WritePrivateProfileString ("Dirs", "current_is_left", WritePrivateProfileString ("Dirs", "current_is_left",
get_current_index () == 0 ? "1" : "0", profile); get_current_index () == 0 ? "1" : "0", profile);

View File

@ -45,7 +45,7 @@
#include "global.h" #include "global.h"
#include "tty.h" /* LINES */ #include "tty.h" /* LINES */
#include "panel.h" /* cpanel */ #include "panel.h" /* current_panel */
#include "wtools.h" /* query_dialog() */ #include "wtools.h" /* query_dialog() */
#include "main.h" /* do_update_prompt() */ #include "main.h" /* do_update_prompt() */
#include "cons.saver.h" /* handle_console() */ #include "cons.saver.h" /* handle_console() */
@ -530,7 +530,7 @@ int invoke_subshell (const char *command, int how, char **new_dir)
/* Make the subshell change to MC's working directory */ /* Make the subshell change to MC's working directory */
if (new_dir) if (new_dir)
do_subshell_chdir (cpanel->cwd, TRUE, 1); do_subshell_chdir (current_panel->cwd, TRUE, 1);
if (command == NULL) /* The user has done "C-o" from MC */ if (command == NULL) /* The user has done "C-o" from MC */
{ {
@ -555,7 +555,7 @@ int invoke_subshell (const char *command, int how, char **new_dir)
feed_subshell (how, FALSE); feed_subshell (how, FALSE);
if (new_dir && subshell_alive && strcmp (subshell_cwd, cpanel->cwd)) if (new_dir && subshell_alive && strcmp (subshell_cwd, current_panel->cwd))
*new_dir = subshell_cwd; /* Make MC change to the subshell's CWD */ *new_dir = subshell_cwd; /* Make MC change to the subshell's CWD */
/* Restart the subshell if it has died by SIGHUP, SIGQUIT, etc. */ /* Restart the subshell if it has died by SIGHUP, SIGQUIT, etc. */
@ -754,7 +754,7 @@ subshell_name_quote (const char *s)
/* If it actually changed the directory it returns true */ /* If it actually changed the directory it returns true */
void do_subshell_chdir (const char *directory, int do_update, int reset_prompt) void do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
{ {
if (!(subshell_state == INACTIVE && strcmp (subshell_cwd, cpanel->cwd))){ if (!(subshell_state == INACTIVE && strcmp (subshell_cwd, current_panel->cwd))){
/* We have to repaint the subshell prompt if we read it from /* We have to repaint the subshell prompt if we read it from
* the main program. Please note that in the code after this * the main program. Please note that in the code after this
* if, the cd command that is sent will make the subshell * if, the cd command that is sent will make the subshell
@ -786,8 +786,8 @@ void do_subshell_chdir (const char *directory, int do_update, int reset_prompt)
subshell_state = RUNNING_COMMAND; subshell_state = RUNNING_COMMAND;
feed_subshell (QUIETLY, FALSE); feed_subshell (QUIETLY, FALSE);
if (subshell_alive && strcmp (subshell_cwd, cpanel->cwd) && strcmp (cpanel->cwd, ".")) if (subshell_alive && strcmp (subshell_cwd, current_panel->cwd) && strcmp (current_panel->cwd, "."))
fprintf (stderr, _("Warning: Cannot change to %s.\n"), cpanel->cwd); fprintf (stderr, _("Warning: Cannot change to %s.\n"), current_panel->cwd);
if (reset_prompt) if (reset_prompt)
prompt_pos = 0; prompt_pos = 0;

View File

@ -822,7 +822,7 @@ chdir_sel (WTree *tree)
} }
change_panel (); change_panel ();
if (do_cd (tree->selected_ptr->name, cd_exact)) { if (do_cd (tree->selected_ptr->name, cd_exact)) {
select_item (cpanel); select_item (current_panel);
} else { } else {
message (1, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "), message (1, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "),
tree->selected_ptr->name, unix_error_string (errno)); tree->selected_ptr->name, unix_error_string (errno));

View File

@ -182,14 +182,14 @@ expand_format (struct WEdit *edit_widget, char c, int quote)
return g_strdup ("%"); return g_strdup ("%");
if (islower ((unsigned) c)) if (islower ((unsigned) c))
panel = cpanel; panel = current_panel;
else { else {
if (get_other_type () != view_listing) if (get_other_type () != view_listing)
return g_strdup (""); return g_strdup ("");
panel = other_panel; panel = other_panel;
} }
if (!panel) if (!panel)
panel = cpanel; panel = current_panel;
if (quote) if (quote)
quote_func = name_quote; quote_func = name_quote;
@ -372,7 +372,7 @@ static char *test_condition (WEdit *edit_widget, char *p, int *condition)
if ((*p == ' ' && *(p-1) != '\\') || *p == '\t') if ((*p == ' ' && *(p-1) != '\\') || *p == '\t')
continue; continue;
if (*p >= 'a') if (*p >= 'a')
panel = cpanel; panel = current_panel;
else { else {
if (get_other_type () == view_listing) if (get_other_type () == view_listing)
panel = other_panel; panel = other_panel;

View File

@ -2637,7 +2637,7 @@ view_hook (void *v)
delete_hook (&idle_hook, view_hook); delete_hook (&idle_hook, view_hook);
if (get_current_type () == view_listing) if (get_current_type () == view_listing)
panel = cpanel; panel = current_panel;
else if (get_other_type () == view_listing) else if (get_other_type () == view_listing)
panel = other_panel; panel = other_panel;
else else

View File

@ -766,11 +766,11 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
parents to the time-outing structure. */ parents to the time-outing structure. */
/* There are three directories we have to take care of: current_dir, /* There are three directories we have to take care of: current_dir,
cpanel->cwd and opanel->cwd. Athough most of the time either current_panel->cwd and other_panel->cwd. Athough most of the time either
current_dir and cpanel->cwd or current_dir and opanel->cwd are the current_dir and current_panel->cwd or current_dir and other_panel->cwd are the
same, it's possible that all three are different -- Norbert */ same, it's possible that all three are different -- Norbert */
if (!cpanel) if (!current_panel)
return; return;
nvfs = vfs_get_class (current_dir); nvfs = vfs_get_class (current_dir);
@ -785,8 +785,8 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
} }
if (get_current_type () == view_listing) { if (get_current_type () == view_listing) {
n2vfs = vfs_get_class (cpanel->cwd); n2vfs = vfs_get_class (current_panel->cwd);
n2vfsid = vfs_ncs_getid (n2vfs, cpanel->cwd, &par); n2vfsid = vfs_ncs_getid (n2vfs, current_panel->cwd, &par);
f = is_parent (oldvfs, oldvfsid, par); f = is_parent (oldvfs, oldvfsid, par);
vfs_rm_parents (par); vfs_rm_parents (par);
if ((n2vfs == oldvfs && n2vfsid == oldvfsid) || f) if ((n2vfs == oldvfs && n2vfsid == oldvfsid) || f)
@ -797,8 +797,8 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
} }
if (get_other_type () == view_listing) { if (get_other_type () == view_listing) {
n3vfs = vfs_get_class (opanel->cwd); n3vfs = vfs_get_class (other_panel->cwd);
n3vfsid = vfs_ncs_getid (n3vfs, opanel->cwd, &par); n3vfsid = vfs_ncs_getid (n3vfs, other_panel->cwd, &par);
f = is_parent (oldvfs, oldvfsid, par); f = is_parent (oldvfs, oldvfsid, par);
vfs_rm_parents (par); vfs_rm_parents (par);
if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f) if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f)
@ -866,14 +866,14 @@ vfs_add_current_stamps (void)
{ {
vfs_stamp_path (current_dir); vfs_stamp_path (current_dir);
if (cpanel) { if (current_panel) {
if (get_current_type () == view_listing) if (get_current_type () == view_listing)
vfs_stamp_path (cpanel->cwd); vfs_stamp_path (current_panel->cwd);
} }
if (opanel) { if (other_panel) {
if (get_other_type () == view_listing) if (get_other_type () == view_listing)
vfs_stamp_path (opanel->cwd); vfs_stamp_path (other_panel->cwd);
} }
} }