* 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>
* 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.
(get_other_panel): Move ...
* layout.c: ... here.

View File

@ -355,7 +355,7 @@ static void chown_refresh (void)
if (!single_set){
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);
}
@ -539,7 +539,7 @@ init_chown_advanced (void)
sf_stat = g_new (struct stat, 1);
do_refresh ();
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);
flag_pos = 0;
x_toggle = 070;
@ -582,17 +582,17 @@ chown_advanced_done (void)
#if 0
static inline void do_chown (uid_t u, gid_t g)
{
chown (cpanel->dir.list[current_file].fname, u, g);
file_mark (cpanel, current_file, 0);
chown (current_panel->dir.list[current_file].fname, u, g);
file_mark (current_panel, current_file, 0);
}
#endif
static char *next_file (void)
{
while (!cpanel->dir.list[current_file].f.marked)
while (!current_panel->dir.list[current_file].f.marked)
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)
@ -601,7 +601,7 @@ static void apply_advanced_chowns (struct stat *sf)
gid_t a_gid = sf->st_gid;
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;
if (mc_chmod (fname, get_mode ()) == -1)
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)
message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0);
do_file_mark (current_panel, current_file, 0);
do {
fname = next_file ();
@ -627,23 +627,23 @@ static void apply_advanced_chowns (struct stat *sf)
message (1, MSG_ERROR, _(" Cannot chown \"%s\" \n %s "),
fname, unix_error_string (errno));
do_file_mark (cpanel, current_file, 0);
} while (cpanel->marked);
do_file_mark (current_panel, current_file, 0);
} while (current_panel->marked);
}
void
chown_advanced_cmd (void)
{
files_on_begin = cpanel->marked;
files_on_begin = current_panel->marked;
do { /* do while any files remaining */
init_chown_advanced ();
if (cpanel->marked)
if (current_panel->marked)
fname = next_file (); /* next marked file */
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 */
destroy_dlg (ch_dlg);
@ -682,12 +682,12 @@ chown_advanced_cmd (void)
}
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL) {
do_file_mark (cpanel, current_file, 0);
if (current_panel->marked && ch_dlg->ret_value != B_CANCEL) {
do_file_mark (current_panel, current_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown);
} while (current_panel->marked && !end_chown);
chown_advanced_done ();
}

View File

@ -189,7 +189,7 @@ init_chmod (void)
do_refresh ();
end_chmod = c_file = need_update = 0;
single_set = (cpanel->marked < 2) ? 2 : 0;
single_set = (current_panel->marked < 2) ? 2 : 0;
ch_dlg =
create_dlg (0, 0, 22 - single_set, 70, dialog_colors,
@ -227,21 +227,21 @@ static void chmod_done (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++;
return cpanel->dir.list[c_file].fname;
return current_panel->dir.list[c_file].fname;
}
static void do_chmod (struct stat *sf)
{
sf->st_mode &= and_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 "),
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)
@ -258,7 +258,7 @@ static void apply_mask (struct stat *sf)
c_stat = sf->st_mode;
do_chmod (sf);
} while (cpanel->marked);
} while (current_panel->marked);
}
void chmod_cmd (void)
@ -271,10 +271,10 @@ void chmod_cmd (void)
do { /* do while any files remaining */
ch_dlg = init_chmod ();
if (cpanel->marked)
if (current_panel->marked)
fname = next_file (); /* next marked file */
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 */
destroy_dlg (ch_dlg);
@ -358,12 +358,12 @@ void chmod_cmd (void)
break;
}
if (cpanel->marked && ch_dlg->ret_value!=B_CANCEL) {
do_file_mark (cpanel, c_file, 0);
if (current_panel->marked && ch_dlg->ret_value!=B_CANCEL) {
do_file_mark (current_panel, c_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chmod);
} while (current_panel->marked && !end_chmod);
chmod_done ();
}

View File

@ -122,10 +122,10 @@ chown_refresh (Dlg_head *h)
static char *
next_file (void)
{
while (!cpanel->dir.list[current_file].f.marked)
while (!current_panel->dir.list[current_file].f.marked)
current_file++;
return cpanel->dir.list[current_file].fname;
return current_panel->dir.list[current_file].fname;
}
static cb_ret_t
@ -151,7 +151,7 @@ init_chown (void)
do_refresh ();
end_chown = need_update = current_file = 0;
single_set = (cpanel->marked < 2) ? 3 : 0;
single_set = (current_panel->marked < 2) ? 3 : 0;
ch_dlg =
create_dlg (0, 0, 18, 74, dialog_colors, chown_callback, "[Chown]",
@ -210,11 +210,11 @@ chown_done (void)
static inline void
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 "),
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
@ -229,7 +229,7 @@ apply_chowns (uid_t u, gid_t g)
fname = next_file ();
do_chown (u,g);
} while (cpanel->marked);
} while (current_panel->marked);
}
#define chown_label(n,txt) label_set_text (chown_label [n].l, txt)
@ -249,10 +249,10 @@ chown_cmd (void)
ch_dlg = init_chown ();
new_user = new_group = -1;
if (cpanel->marked)
if (current_panel->marked)
fname = next_file (); /* next marked file */
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 */
destroy_dlg (ch_dlg);
@ -327,12 +327,12 @@ chown_cmd (void)
}
}
if (cpanel->marked && ch_dlg->ret_value != B_CANCEL){
do_file_mark (cpanel, current_file, 0);
if (current_panel->marked && ch_dlg->ret_value != B_CANCEL){
do_file_mark (current_panel, current_file, 0);
need_update = 1;
}
destroy_dlg (ch_dlg);
} while (cpanel->marked && !end_chown);
} while (current_panel->marked && !end_chown);
chown_done ();
}

View File

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

View File

@ -146,7 +146,7 @@ void do_cd_command (char *cmd)
if (cmd [0] == 0){
sync_tree (home_dir);
} else if (strcmp (cmd+3, "..") == 0){
char *dir = cpanel->cwd;
char *dir = current_panel->cwd;
int len = strlen (dir);
while (len && dir [--len] != PATH_SEP);
dir [len] = 0;
@ -157,7 +157,7 @@ void do_cd_command (char *cmd)
} else if (cmd [3] == PATH_SEP){
sync_tree (cmd+3);
} else {
char *old = cpanel->cwd;
char *old = current_panel->cwd;
char *new;
new = concat_dir_and_file (old, cmd+3);
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
* may end up invoking update_panels thus making the
* 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) {
char *filename_copy = g_strdup (filename);

View File

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

View File

@ -65,7 +65,7 @@
#define WANT_WIDGETS
#include "main.h" /* the_hint */
#include "wtools.h" /* QuickDialog */
#include "panel.h" /* cpanel */
#include "panel.h" /* current_panel */
#include "fileopctx.h" /* FILE_CONT */
#include "filegui.h"
#include "key.h" /* get_event */
@ -442,10 +442,10 @@ file_progress_show_source (FileOpContext *ctx, char *s)
if (s != NULL) {
#ifdef WITH_FULL_PATHS
int i = strlen (cpanel->cwd);
int i = strlen (current_panel->cwd);
/* 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)
s += i + 1;
}

View File

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

View File

@ -44,7 +44,7 @@
#include "setup.h" /* For profile_bname */
#include "profile.h" /* Load/save directories hotlist */
#include "wtools.h" /* QuickDialog */
#include "panel.h" /* cpanel */
#include "panel.h" /* current_panel */
#include "main.h" /* repaint_screen */
#include "hotlist.h"
#include "key.h" /* KEY_M_CTRL */
@ -901,7 +901,7 @@ static void add_new_entry_cmd (void)
int ret;
/* 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"),
"[Hotlist]", &title, &url);
@ -1001,13 +1001,13 @@ void add2hotlist_cmd (void)
char *cp = _("Label for \"%s\":");
int l = strlen (cp);
prompt = g_strdup_printf (cp, name_trunc (cpanel->cwd, COLS-2*UX-(l+8)));
label = input_dialog (_(" Add to hotlist "), prompt, cpanel->cwd);
prompt = g_strdup_printf (cp, name_trunc (current_panel->cwd, COLS-2*UX-(l+8)));
label = input_dialog (_(" Add to hotlist "), prompt, current_panel->cwd);
g_free (prompt);
if (!label || !*label)
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;
}

View File

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

View File

@ -990,11 +990,11 @@ void set_display_type (int num, int type)
* - select left panel
* - invoke menue left/tree
* - 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 (cpanel == (WPanel *) old_widget)
if (current_panel == (WPanel *) old_widget)
current_panel = num == 0 ? right_panel : left_panel;
}
@ -1033,7 +1033,7 @@ void swap_panels ()
panel1->searching = 0;
panel2->searching = 0;
if (cpanel == panel1)
if (current_panel == panel1)
current_panel = panel2;
else
current_panel = panel1;
@ -1098,7 +1098,7 @@ get_panel_widget (int index)
int get_current_index (void)
{
if (panels [0].widget == ((Widget *) cpanel))
if (panels [0].widget == ((Widget *) current_panel))
return 0;
else
return 1;
@ -1118,7 +1118,7 @@ get_other_panel (void)
/* Returns the view type for the current panel/view */
int get_current_type (void)
{
if (panels [0].widget == (Widget *) cpanel)
if (panels [0].widget == (Widget *) current_panel)
return panels [0].type;
else
return panels [1].type;
@ -1127,7 +1127,7 @@ int get_current_type (void)
/* Returns the view type of the unselected panel */
int get_other_type (void)
{
if (panels [0].widget == (Widget *) cpanel)
if (panels [0].widget == (Widget *) current_panel)
return panels [1].type;
else
return panels [0].type;

View File

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

View File

@ -91,9 +91,6 @@ void update_dirty_panels (void);
void panel_update_cols (Widget *widget, int frame_size);
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()
extern WPanel *left_panel;

View File

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

View File

@ -808,11 +808,11 @@ paint_panel (WPanel *panel)
void
update_dirty_panels (void)
{
if (cpanel->dirty)
panel_update_contents (cpanel);
if (current_panel->dirty)
panel_update_contents (current_panel);
if ((get_other_type () == view_listing) && opanel->dirty)
panel_update_contents (opanel);
if ((get_other_type () == view_listing) && other_panel->dirty)
panel_update_contents (other_panel);
}
static void
@ -1939,7 +1939,7 @@ do_enter_on_file_entry (file_entry *fe)
return 1;
/* 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)) {
g_free (full_name);
return 0;
@ -1997,7 +1997,7 @@ chdir_other_panel (WPanel *panel)
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 */
if (!panel->is_panelized) {

View File

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

View File

@ -45,7 +45,7 @@
#include "global.h"
#include "tty.h" /* LINES */
#include "panel.h" /* cpanel */
#include "panel.h" /* current_panel */
#include "wtools.h" /* query_dialog() */
#include "main.h" /* do_update_prompt() */
#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 */
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 */
{
@ -555,7 +555,7 @@ int invoke_subshell (const char *command, int how, char **new_dir)
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 */
/* 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 */
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
* the main program. Please note that in the code after this
* 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;
feed_subshell (QUIETLY, FALSE);
if (subshell_alive && strcmp (subshell_cwd, cpanel->cwd) && strcmp (cpanel->cwd, "."))
fprintf (stderr, _("Warning: Cannot change to %s.\n"), cpanel->cwd);
if (subshell_alive && strcmp (subshell_cwd, current_panel->cwd) && strcmp (current_panel->cwd, "."))
fprintf (stderr, _("Warning: Cannot change to %s.\n"), current_panel->cwd);
if (reset_prompt)
prompt_pos = 0;

View File

@ -822,7 +822,7 @@ chdir_sel (WTree *tree)
}
change_panel ();
if (do_cd (tree->selected_ptr->name, cd_exact)) {
select_item (cpanel);
select_item (current_panel);
} else {
message (1, MSG_ERROR, _(" Cannot chdir to \"%s\" \n %s "),
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 ("%");
if (islower ((unsigned) c))
panel = cpanel;
panel = current_panel;
else {
if (get_other_type () != view_listing)
return g_strdup ("");
panel = other_panel;
}
if (!panel)
panel = cpanel;
panel = current_panel;
if (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')
continue;
if (*p >= 'a')
panel = cpanel;
panel = current_panel;
else {
if (get_other_type () == view_listing)
panel = other_panel;

View File

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

View File

@ -766,11 +766,11 @@ _vfs_add_noncurrent_stamps (struct vfs_class *oldvfs, vfsid oldvfsid,
parents to the time-outing structure. */
/* There are three directories we have to take care of: current_dir,
cpanel->cwd and opanel->cwd. Athough most of the time either
current_dir and cpanel->cwd or current_dir and opanel->cwd are the
current_panel->cwd and other_panel->cwd. Athough most of the time either
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 */
if (!cpanel)
if (!current_panel)
return;
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) {
n2vfs = vfs_get_class (cpanel->cwd);
n2vfsid = vfs_ncs_getid (n2vfs, cpanel->cwd, &par);
n2vfs = vfs_get_class (current_panel->cwd);
n2vfsid = vfs_ncs_getid (n2vfs, current_panel->cwd, &par);
f = is_parent (oldvfs, oldvfsid, par);
vfs_rm_parents (par);
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) {
n3vfs = vfs_get_class (opanel->cwd);
n3vfsid = vfs_ncs_getid (n3vfs, opanel->cwd, &par);
n3vfs = vfs_get_class (other_panel->cwd);
n3vfsid = vfs_ncs_getid (n3vfs, other_panel->cwd, &par);
f = is_parent (oldvfs, oldvfsid, par);
vfs_rm_parents (par);
if ((n3vfs == oldvfs && n3vfsid == oldvfsid) || f)
@ -866,14 +866,14 @@ vfs_add_current_stamps (void)
{
vfs_stamp_path (current_dir);
if (cpanel) {
if (current_panel) {
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)
vfs_stamp_path (opanel->cwd);
vfs_stamp_path (other_panel->cwd);
}
}