24 |
void |
void |
25 |
arshell_insert_file_cb() |
arshell_insert_file_cb() |
26 |
{ |
{ |
27 |
|
ARBUG; |
28 |
|
|
29 |
char *file=antiright_pipe_read("cat `arshell -ADf`"); |
char *file=antiright_pipe_read("cat `arshell -ADf`"); |
30 |
XmTextInsert(arshell.gui.widgets.work, |
XmTextInsert(arshell.gui.widgets.work, |
31 |
XmTextGetInsertionPosition(arshell.gui.widgets.work), |
XmTextGetInsertionPosition(arshell.gui.widgets.work), |
38 |
XtPointer client_data, |
XtPointer client_data, |
39 |
XtPointer call_data) |
XtPointer call_data) |
40 |
{ |
{ |
41 |
|
ARBUG; |
42 |
|
|
43 |
char *label; |
char *label; |
44 |
XmString motif_string; |
XmString motif_string; |
45 |
ARCLARG; |
ARCLARG; |
58 |
void |
void |
59 |
arshell_open_file() |
arshell_open_file() |
60 |
{ |
{ |
61 |
|
ARBUG; |
62 |
|
|
63 |
char *command_string; |
char *command_string; |
64 |
char *buffer; |
char *buffer; |
65 |
asprintf(&command_string, "cat %s", arshell.edit.filename); |
asprintf(&command_string, "cat %s", arshell.edit.filename); |
86 |
XtPointer client_data, |
XtPointer client_data, |
87 |
XtPointer call_data) |
XtPointer call_data) |
88 |
{ |
{ |
89 |
|
ARBUG; |
90 |
XmFileSelectionBoxCallbackStruct *call_pointer=call_data; |
XmFileSelectionBoxCallbackStruct *call_pointer=call_data; |
91 |
char *c_string; |
char *c_string; |
92 |
|
|
93 |
if(arshell.flags.file_open) |
if(arshell.flags.file_open) |
94 |
{ |
{ |
95 |
|
ARBUG; |
96 |
arshell_save_work_area(); |
arshell_save_work_area(); |
97 |
} |
} |
98 |
c_string=antiright_c_string(call_pointer->value); |
c_string=antiright_c_string(call_pointer->value); |
101 |
XtDestroyWidget(widget); |
XtDestroyWidget(widget); |
102 |
if(arshell.flags.saving) |
if(arshell.flags.saving) |
103 |
{ |
{ |
104 |
|
ARBUG; |
105 |
arshell.flags.file_open=True; |
arshell.flags.file_open=True; |
106 |
arshell_save_work_area(); |
arshell_save_work_area(); |
107 |
arshell.flags.saving=False; |
arshell.flags.saving=False; |
108 |
} |
} |
109 |
if(arshell.flags.opening) |
if(arshell.flags.opening) |
110 |
{ |
{ |
111 |
|
ARBUG; |
112 |
arshell.flags.file_open=True; |
arshell.flags.file_open=True; |
113 |
arshell_open_file(); |
arshell_open_file(); |
114 |
arshell.flags.opening=False; |
arshell.flags.opening=False; |
119 |
void |
void |
120 |
arshell_select_filename() |
arshell_select_filename() |
121 |
{ |
{ |
122 |
|
ARBUG; |
123 |
Widget file_selection_widget; |
Widget file_selection_widget; |
124 |
ARCLARG; |
ARCLARG; |
125 |
antiright_set(XmNtitle, (XtArgVal)"File Selector"); |
antiright_set(XmNtitle, (XtArgVal)"File Selector"); |
139 |
void |
void |
140 |
arshell_put_text_into_file(FILE *file) |
arshell_put_text_into_file(FILE *file) |
141 |
{ |
{ |
142 |
|
ARBUG; |
143 |
char *text_string; |
char *text_string; |
144 |
assert(arshell.gui.widgets.work != NULL); |
assert(arshell.gui.widgets.work != NULL); |
145 |
text_string=XmTextGetString(arshell.gui.widgets.work); |
text_string=XmTextGetString(arshell.gui.widgets.work); |
149 |
void |
void |
150 |
arshell_open_file_for_writing(FILE **file_pointer) |
arshell_open_file_for_writing(FILE **file_pointer) |
151 |
{ |
{ |
152 |
|
ARBUG; |
153 |
(*file_pointer)=fopen(arshell.edit.filename, "w"); |
(*file_pointer)=fopen(arshell.edit.filename, "w"); |
154 |
if((*file_pointer)==NULL) |
if((*file_pointer)==NULL) |
155 |
{ |
{ |
160 |
void |
void |
161 |
arshell_save_work_area() |
arshell_save_work_area() |
162 |
{ |
{ |
163 |
|
ARBUG; |
164 |
FILE* file_pointer; |
FILE* file_pointer; |
165 |
arshell.flags.saving=True; |
arshell.flags.saving=True; |
166 |
if(arshell.flags.file_open==False) |
if(arshell.flags.file_open==False) |
167 |
{ |
{ |
168 |
|
ARBUG; |
169 |
arshell_select_filename(); |
arshell_select_filename(); |
170 |
} |
} |
171 |
else |
else |
172 |
{ |
{ |
173 |
|
ARBUG; |
174 |
arshell_open_file_for_writing(&file_pointer); |
arshell_open_file_for_writing(&file_pointer); |
175 |
arshell_put_text_into_file(file_pointer); |
arshell_put_text_into_file(file_pointer); |
176 |
fclose(file_pointer); |
fclose(file_pointer); |
177 |
arshell_get_rid_of_modified_status(); |
arshell_get_rid_of_modified_status(); |
178 |
antiright_set_title(arshell.edit.filename); |
antiright_set_title(arshell.edit.filename); |
179 |
} |
} |
180 |
|
arshell.flags.saving=False; |
181 |
} |
} |
182 |
|
|
183 |
void |
void |
184 |
arshell_save_as_cb() |
arshell_save_as_cb() |
185 |
{ |
{ |
186 |
|
ARBUG; |
187 |
|
arshell.flags.saving=True; |
188 |
arshell_select_filename(); |
arshell_select_filename(); |
|
arshell_save_work_area(); |
|
189 |
} |
} |
190 |
|
|
191 |
void |
void |
192 |
arshell_open_cb() |
arshell_open_cb() |
193 |
{ |
{ |
194 |
|
ARBUG; |
195 |
arshell.flags.opening=True; |
arshell.flags.opening=True; |
196 |
|
arshell.flags.saving=False; |
197 |
arshell_select_filename(); |
arshell_select_filename(); |
198 |
} |
} |