/[antiright]/antiright/src/arshell/file.c
ViewVC logotype

Diff of /antiright/src/arshell/file.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jefbed, Tue Aug 17 20:36:22 2004 UTC revision 1.4 by jefbed, Wed Aug 25 23:50:18 2004 UTC
# Line 23  Line 23 
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),
# Line 37  void Line 35  void
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;
# Line 57  arshell_open_file_cb(Widget parent_widge Line 53  arshell_open_file_cb(Widget parent_widge
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);
# Line 86  arshell_file_select_ok_cb(Widget widget, Line 80  arshell_file_select_ok_cb(Widget widget,
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);
# Line 100  arshell_file_select_ok_cb(Widget widget, Line 92  arshell_file_select_ok_cb(Widget widget,
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;
# Line 119  arshell_file_select_ok_cb(Widget widget, Line 109  arshell_file_select_ok_cb(Widget widget,
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");
# Line 138  arshell_select_filename() Line 128  arshell_select_filename()
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);
# Line 148  arshell_put_text_into_file(FILE *file) Line 137  arshell_put_text_into_file(FILE *file)
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      {      {
# Line 160  arshell_open_file_for_writing(FILE **fil Line 148  arshell_open_file_for_writing(FILE **fil
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);
# Line 182  arshell_save_work_area() Line 167  arshell_save_work_area()
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  }  }
# Line 191  arshell_save_as_cb() Line 175  arshell_save_as_cb()
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();

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26