23 |
|
|
24 |
void |
void |
25 |
arshell_insert_file_cb() |
arshell_insert_file_cb() |
26 |
{ |
{ |
|
ARBUG; |
|
|
|
|
27 |
char *file=antiright_pipe_read("cat `arshell -ADf`"); |
char *file=antiright_pipe_read("cat `arshell -ADf`"); |
28 |
XmTextInsert(arshell.gui.widgets.work, |
XmTextInsert(arshell.gui.widgets.work, |
29 |
XmTextGetInsertionPosition(arshell.gui.widgets.work), |
XmTextGetInsertionPosition(arshell.gui.widgets.work), |
35 |
arshell_open_file_cb(Widget parent_widget, |
arshell_open_file_cb(Widget parent_widget, |
36 |
XtPointer client_data, |
XtPointer client_data, |
37 |
XtPointer call_data) |
XtPointer call_data) |
38 |
{ |
{ |
|
ARBUG; |
|
|
|
|
39 |
char *label; |
char *label; |
40 |
XmString motif_string; |
XmString motif_string; |
41 |
ARCLARG; |
ARCLARG; |
53 |
|
|
54 |
void |
void |
55 |
arshell_open_file() |
arshell_open_file() |
56 |
{ |
{ |
|
ARBUG; |
|
|
|
|
57 |
char *command_string; |
char *command_string; |
58 |
char *buffer; |
char *buffer; |
59 |
asprintf(&command_string, "cat %s", arshell.edit.filename); |
asprintf(&command_string, "cat %s", arshell.edit.filename); |
80 |
XtPointer client_data, |
XtPointer client_data, |
81 |
XtPointer call_data) |
XtPointer call_data) |
82 |
{ |
{ |
|
ARBUG; |
|
83 |
XmFileSelectionBoxCallbackStruct *call_pointer=call_data; |
XmFileSelectionBoxCallbackStruct *call_pointer=call_data; |
84 |
char *c_string; |
char *c_string; |
85 |
|
|
86 |
if(arshell.flags.file_open) |
if(arshell.flags.file_open) |
87 |
{ |
{ |
|
ARBUG; |
|
88 |
arshell_save_work_area(); |
arshell_save_work_area(); |
89 |
} |
} |
90 |
c_string=antiright_c_string(call_pointer->value); |
c_string=antiright_c_string(call_pointer->value); |
92 |
XtFree(c_string); |
XtFree(c_string); |
93 |
XtDestroyWidget(widget); |
XtDestroyWidget(widget); |
94 |
if(arshell.flags.saving) |
if(arshell.flags.saving) |
95 |
{ |
{ |
|
ARBUG; |
|
96 |
arshell.flags.file_open=True; |
arshell.flags.file_open=True; |
97 |
arshell_save_work_area(); |
arshell_save_work_area(); |
98 |
arshell.flags.saving=False; |
arshell.flags.saving=False; |
99 |
} |
} |
100 |
if(arshell.flags.opening) |
if(arshell.flags.opening) |
101 |
{ |
{ |
|
ARBUG; |
|
102 |
arshell.flags.file_open=True; |
arshell.flags.file_open=True; |
103 |
arshell_open_file(); |
arshell_open_file(); |
104 |
arshell.flags.opening=False; |
arshell.flags.opening=False; |
109 |
void |
void |
110 |
arshell_select_filename() |
arshell_select_filename() |
111 |
{ |
{ |
112 |
ARBUG; |
|
113 |
Widget file_selection_widget; |
Widget file_selection_widget; |
114 |
ARCLARG; |
ARCLARG; |
115 |
antiright_set(XmNtitle, (XtArgVal)"File Selector"); |
antiright_set(XmNtitle, (XtArgVal)"File Selector"); |
128 |
} |
} |
129 |
void |
void |
130 |
arshell_put_text_into_file(FILE *file) |
arshell_put_text_into_file(FILE *file) |
131 |
{ |
{ |
|
ARBUG; |
|
132 |
char *text_string; |
char *text_string; |
133 |
assert(arshell.gui.widgets.work != NULL); |
assert(arshell.gui.widgets.work != NULL); |
134 |
text_string=XmTextGetString(arshell.gui.widgets.work); |
text_string=XmTextGetString(arshell.gui.widgets.work); |
137 |
} |
} |
138 |
void |
void |
139 |
arshell_open_file_for_writing(FILE **file_pointer) |
arshell_open_file_for_writing(FILE **file_pointer) |
140 |
{ |
{ |
|
ARBUG; |
|
141 |
(*file_pointer)=fopen(arshell.edit.filename, "w"); |
(*file_pointer)=fopen(arshell.edit.filename, "w"); |
142 |
if((*file_pointer)==NULL) |
if((*file_pointer)==NULL) |
143 |
{ |
{ |
148 |
void |
void |
149 |
arshell_save_work_area() |
arshell_save_work_area() |
150 |
{ |
{ |
|
ARBUG; |
|
151 |
FILE* file_pointer; |
FILE* file_pointer; |
152 |
arshell.flags.saving=True; |
arshell.flags.saving=True; |
153 |
if(arshell.flags.file_open==False) |
if(arshell.flags.file_open==False) |
154 |
{ |
{ |
|
ARBUG; |
|
155 |
arshell_select_filename(); |
arshell_select_filename(); |
156 |
} |
} |
157 |
else |
else |
158 |
{ |
{ |
|
ARBUG; |
|
159 |
arshell_open_file_for_writing(&file_pointer); |
arshell_open_file_for_writing(&file_pointer); |
160 |
arshell_put_text_into_file(file_pointer); |
arshell_put_text_into_file(file_pointer); |
161 |
fclose(file_pointer); |
fclose(file_pointer); |
167 |
|
|
168 |
void |
void |
169 |
arshell_save_as_cb() |
arshell_save_as_cb() |
170 |
{ |
{ |
|
ARBUG; |
|
171 |
arshell.flags.saving=True; |
arshell.flags.saving=True; |
172 |
arshell_select_filename(); |
arshell_select_filename(); |
173 |
} |
} |
175 |
void |
void |
176 |
arshell_open_cb() |
arshell_open_cb() |
177 |
{ |
{ |
|
ARBUG; |
|
178 |
arshell.flags.opening=True; |
arshell.flags.opening=True; |
179 |
arshell.flags.saving=False; |
arshell.flags.saving=False; |
180 |
arshell_select_filename(); |
arshell_select_filename(); |