~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to avidemux/ADM_gui2/GUI_bindings.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-05-25 13:02:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050525130229-jw94cav0yhmg7vjw
Tags: 1:2.0.40-0.0
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#include "ADM_codecs/ADM_codec.h"
44
44
#include "ADM_gui2/GUI_ui.h"
45
45
 
 
46
#include "ADM_toolkit/filesel.h"
 
47
#include "ADM_editor/ADM_Video.h"
 
48
 
46
49
void frame2time(uint32_t frame, uint32_t fps, uint16_t * hh, uint16_t * mm,
47
50
           uint16_t * ss, uint16_t * ms);
48
51
 
68
71
 
69
72
// heek !
70
73
static  GtkAdjustment *sliderAdjustment;
71
 
 
72
 
 
 
74
// Needed for DND
 
75
extern void A_openAvi (char *name);
 
76
extern void A_appendAvi (char *name);
 
77
 
 
78
 
 
79
 
 
80
//
 
81
enum 
 
82
{
 
83
        TARGET_STRING,
 
84
        TARGET_ROOTWIN,
 
85
        TARGET_URL
 
86
};
 
87
enum 
 
88
{
 
89
   TARGET_URI_LIST
 
90
};
 
91
 
 
92
static GtkTargetEntry target_table[] = 
 
93
{
 
94
  { "STRING",     0, TARGET_STRING },
 
95
  { "text/plain", 0, TARGET_STRING },
 
96
  { "text/uri-list", 0, TARGET_URL },
 
97
  { "application/x-rootwin-drop", 0, TARGET_ROOTWIN }
 
98
};
 
99
// CYB 2005.02.22: DND (END)
 
100
 
 
101
 
 
102
static void DNDDataReceived( GtkWidget *widget, GdkDragContext *dc,
 
103
                             gint x, gint y, GtkSelectionData *selection_data, guint info, guint t);
 
104
 
 
105
extern aviInfo   *avifileinfo;
73
106
extern GtkWidget        *create_mainWindow (void);
74
107
extern void guiCallback(GtkMenuItem * menuitem, gpointer user_data);
75
108
extern void HandleAction(Action act);
76
109
extern void UI_on_key_press(GtkWidget *widget, GdkEventKey* event, gpointer user_data);
 
110
extern void fileReadWrite(SELFILE_CB cb, int rw, char *name);
 
111
 
77
112
// To build vcodec
78
113
extern uint32_t encoderGetNbEncoder(void);
79
114
extern const char* encoderGetIndexedName(uint32_t i);
311
346
                        gtk_container_add (GTK_CONTAINER (menua), audWidget[i]);
312
347
                }
313
348
         gtk_option_menu_set_menu (GTK_OPTION_MENU (lookup_widget(guiRootWindow,"optionACodec")), menua);
314
 
 
 
349
    //
 
350
    //
 
351
    //CYB 2005.02.22: DND (START)
 
352
    // Set up avidemux as an available drag'n'drop target.
 
353
    gtk_drag_dest_set(guiRootWindow,
 
354
        GTK_DEST_DEFAULT_ALL,
 
355
        target_table,sizeof(target_table)/sizeof(GtkTargetEntry),
 
356
        (GdkDragAction)(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_DEFAULT));
 
357
    g_signal_connect(GTK_OBJECT(guiRootWindow), "drag_data_received",
 
358
        GTK_SIGNAL_FUNC(DNDDataReceived),NULL);
 
359
    //CYB 2005.02.22: DND (END)
315
360
    return 1;
316
361
 
317
362
}
562
607
    Action act;
563
608
    uint32_t aint;
564
609
 
565
 
    aint = (uint32_t) user_data;
 
610
    aint = (long int) user_data;
566
611
    act = (Action) aint;
567
612
    if(act==ACT_Scale)
568
613
    {
666
711
        gtk_option_menu_set_history(GTK_OPTION_MENU(lookup_widget(guiRootWindow,"optionmenu1")), fmt);
667
712
        return 1;
668
713
}
 
714
// DND CYB
 
715
void DNDDataReceived( GtkWidget *widget, GdkDragContext *dc,
 
716
                                  gint x, gint y, GtkSelectionData *selection_data, guint info, guint t)
 
717
{
 
718
   void *filename;
 
719
   char *start,*end;
 
720
   int cont;
 
721
 
 
722
    if (info == TARGET_URI_LIST)
 
723
    {
 
724
     start = strstr((char*)selection_data->data,"file://");
 
725
     cont = 0;
 
726
     do
 
727
     {
 
728
       if (start)
 
729
       {
 
730
        end = strstr((char*)start+1,"file://");
 
731
        if (!end)
 
732
        {
 
733
                      end = start + strlen(start);
 
734
                      cont = 1;
 
735
                      continue;
 
736
        }
 
737
        filename = ADM_alloc(end-start); 
 
738
        if (filename)
 
739
        {
 
740
              memset(filename,0,end-start);
 
741
              memcpy(filename,start+7,end-start-7-2);
 
742
              if (avifileinfo) 
 
743
              {
 
744
                    // Append video when there's already something
 
745
                    fileReadWrite(A_appendAvi, 0, (char*)filename);
 
746
               }
 
747
               else
 
748
               {
 
749
                    fileReadWrite(A_openAvi, 0, (char*)filename);
 
750
               }
 
751
         } 
 
752
         ADM_dealloc(filename);
 
753
         start = end;
 
754
       }
 
755
       else
 
756
       {
 
757
           cont=1;
 
758
       } 
 
759
     } //do
 
760
     while (!cont);  
 
761
    }
 
762
    gtk_drag_finish(dc,TRUE,FALSE,t);
 
763
}
669
764
 
670
765
// EOF