115 |
|
|
116 |
/* ***** ***** ***** */ |
/* ***** ***** ***** */ |
117 |
|
|
118 |
|
DirStruct *bookmarkDelete(DirStruct *bm){ |
119 |
|
DirStruct *tmp; |
120 |
|
DirStruct *new_sel; |
121 |
|
|
122 |
|
new_sel=NULL; |
123 |
|
if (bm!=NULL) { |
124 |
|
if (bm->prev==NULL && bm->next==NULL) { |
125 |
|
Bookmarks=NULL; |
126 |
|
b_sel_ds=NULL; |
127 |
|
b_first=NULL; |
128 |
|
b_sel_name=NULL; |
129 |
|
} |
130 |
|
else { |
131 |
|
if (bm->next!=NULL) bm->next->prev=bm->prev; |
132 |
|
else Bookmarks->last=bm->prev; |
133 |
|
if (bm->prev!=NULL) { |
134 |
|
bm->prev->next=bm->next; |
135 |
|
new_sel=bm->prev; |
136 |
|
} else { |
137 |
|
new_sel=bm->next; |
138 |
|
Bookmarks=bm->next; |
139 |
|
Bookmarks->index=1; |
140 |
|
Bookmarks->first=Bookmarks; |
141 |
|
} |
142 |
|
bm->next=bm->prev=NULL; |
143 |
|
|
144 |
|
tmp=Bookmarks; |
145 |
|
if (bm->dir) tmp->dir_count--; |
146 |
|
else tmp->files_count--; |
147 |
|
|
148 |
|
while (tmp->next!=NULL) { |
149 |
|
tmp->next->dir_count=tmp->dir_count; |
150 |
|
tmp->next->files_count=tmp->files_count; |
151 |
|
tmp->next->index=tmp->index+1; |
152 |
|
tmp->next->first=tmp->first; |
153 |
|
tmp->next->last=tmp->last; |
154 |
|
tmp=tmp->next; |
155 |
|
} |
156 |
|
|
157 |
|
} |
158 |
|
dirFree(bm); |
159 |
|
} |
160 |
|
|
161 |
|
return new_sel; |
162 |
|
} |
163 |
|
|
164 |
DirStruct *bookmarkInsert(DirStruct *bm){ |
DirStruct *bookmarkInsert(DirStruct *bm){ |
165 |
DirStruct *tmp; |
DirStruct *tmp; |
166 |
int ti; |
int ti; |
1143 |
OClock(); |
OClock(); |
1144 |
viewportRefresh(); |
viewportRefresh(); |
1145 |
} |
} |
1146 |
|
|
1147 |
|
/* change of sort mode */ |
1148 |
else if(i==CTRL('u')){ |
else if(i==CTRL('u')){ |
1149 |
tmp->sort_mode=(++tmp->sort_mode)%SORT_MODES; |
tmp->sort_mode=(++tmp->sort_mode)%SORT_MODES; |
1150 |
tmp->reread=1; |
tmp->reread=1; |
1151 |
opanelRefresh(tmp); |
opanelRefresh(tmp); |
1152 |
} |
} |
1153 |
|
|
1154 |
|
/* switch to subshell */ |
1155 |
else if (i==CTRL('o')) { |
else if (i==CTRL('o')) { |
1156 |
erase(); |
erase(); |
1157 |
refresh(); |
refresh(); |
1164 |
viewportRefresh(); |
viewportRefresh(); |
1165 |
curs_set(0); |
curs_set(0); |
1166 |
} |
} |
1167 |
|
|
1168 |
|
/* switch to/from bookmarks' dir displaying in active panel */ |
1169 |
else if (i==CTRL('b') && Bookmarks!=NULL) { |
else if (i==CTRL('b') && Bookmarks!=NULL) { |
1170 |
if (bookmark_is_active) { |
if (bookmark_is_active-1==opanelActive) { |
1171 |
if (bookmark_is_active-1==opanelActive) { |
bookmarkRestoreState(tmp); |
1172 |
bookmarkRestoreState(tmp); |
tmp->reread=1; |
1173 |
tmp->reread=1; |
bookmark_is_active=0; |
|
} |
|
1174 |
} else { |
} else { |
1175 |
|
if (bookmark_is_active) { |
1176 |
|
bookmarkRestoreState(opanels[! opanelActive]); |
1177 |
|
opanels[! opanelActive]->reread=1; |
1178 |
|
opanelRefresh(opanels[! opanelActive]); |
1179 |
|
} |
1180 |
|
|
1181 |
bookmark_is_active=opanelActive+1; |
bookmark_is_active=opanelActive+1; |
1182 |
bookmarkSaveState(tmp); |
bookmarkSaveState(tmp); |
1183 |
tmp->reread=1; |
tmp->reread=1; |
1184 |
} |
} |
1185 |
|
|
1186 |
opanelRefresh(tmp); |
opanelRefresh(tmp); |
1187 |
} |
} |
1188 |
|
|
1189 |
|
/* add bookmark */ |
1190 |
else if (i==CTRL('a')) { |
else if (i==CTRL('a')) { |
1191 |
if (opanelActive+1!=bookmark_is_active) { |
if (opanelActive+1!=bookmark_is_active) { |
1192 |
bookmarkInsert(tmp->sel_ds); |
bookmarkInsert(tmp->sel_ds); |
1196 |
} |
} |
1197 |
} |
} |
1198 |
} |
} |
1199 |
|
|
1200 |
|
/* delete selected bookmark */ |
1201 |
|
else if (i==CTRL('d')) { |
1202 |
|
if (bookmark_is_active==opanelActive+1) { |
1203 |
|
tmp->sel_ds=bookmarkDelete(tmp->sel_ds); |
1204 |
|
if (Bookmarks==NULL) { |
1205 |
|
bookmarkRestoreState(tmp); |
1206 |
|
tmp->reread=1; |
1207 |
|
} else { |
1208 |
|
tmp->dir=Bookmarks; |
1209 |
|
tmp->first=Bookmarks->first; |
1210 |
|
tmp->sel_name=NULL; |
1211 |
|
} |
1212 |
|
opanelRefresh(tmp); |
1213 |
|
} |
1214 |
|
} |
1215 |
|
|
1216 |
|
/* add ascii character to command's string */ |
1217 |
else if (isascii(i)) { |
else if (isascii(i)) { |
1218 |
if (cmd_size<sizeof(cmd_buffer)) { |
if (cmd_size<sizeof(cmd_buffer)) { |
1219 |
cmd_buffer[cmd_size++]=(char)i; |
cmd_buffer[cmd_size++]=(char)i; |
1220 |
writeinfo(2); //refresh bottom info |
writeinfo(2); //refresh bottom info |
1221 |
} |
} |
1222 |
} |
} |
1223 |
|
|
1224 |
|
/* delete last character in command's string */ |
1225 |
else if (i==KEY_BACKSPACE && cmd_size>0) { |
else if (i==KEY_BACKSPACE && cmd_size>0) { |
1226 |
cmd_buffer[--cmd_size]='\0'; |
cmd_buffer[--cmd_size]='\0'; |
1227 |
writeinfo(2); |
writeinfo(2); |