2 * Panel_Comments.h -- Comments panel
3 * Copyright (C) 2004-2005 Ushodaya Enterprises Limited
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "Panel_Comments.h"
23 using namespace shotcut
;
25 #include <FL/Fl_Multiline_Input.H>
27 class NLE_Comments
: public NLE_Panel
32 Fl_Multiline_Input
*project_input
;
33 Fl_Multiline_Input
*clip_input
;
34 Fl_Multiline_Input
*cut_input
;
37 NLE_Comments( int x
, int y
, int w
, int h
, const char *label
) :
38 NLE_Panel( x
, y
, w
, h
, label
),
41 title
= new Fl_Input( x
+ 5, y
+ 15, w
- 10, 24 );
42 title
->labelsize( 10 );
43 title
->label( "Project Title" );
44 title
->align( FL_ALIGN_LEFT
| FL_ALIGN_TOP
);
45 title
->callback( static_input_cb
, this );
46 title
->textsize( 12 );
48 project_input
= new Fl_Multiline_Input( x
+ 5, y
+ 55, w
- 10, h
/ 3 - 20 );
49 project_input
->labelsize( 10 );
50 project_input
->label( "Project Comments" );
51 project_input
->align( FL_ALIGN_LEFT
| FL_ALIGN_TOP
);
52 project_input
->wrap( 1 );
53 project_input
->callback( static_input_cb
, this );
54 project_input
->textsize( 12 );
55 clip_input
= new Fl_Multiline_Input( x
+ 5, y
+ h
/ 3 + 50, w
- 10, h
/ 3 - 20 );
56 clip_input
->label( "Clip Comments" );
57 clip_input
->labelsize( 10 );
58 clip_input
->wrap( 1 );
59 clip_input
->align( FL_ALIGN_LEFT
| FL_ALIGN_TOP
);
60 clip_input
->callback( static_input_cb
, this );
61 clip_input
->textsize( 12 );
62 cut_input
= new Fl_Multiline_Input( x
+ 5, y
+ 2 * h
/ 3 + 50, w
- 10, h
/ 3 - 20 );
63 cut_input
->labelsize( 10 );
64 cut_input
->label( "Cut Comments" );
65 cut_input
->align( FL_ALIGN_LEFT
| FL_ALIGN_TOP
);
67 cut_input
->callback( static_input_cb
, this );
68 cut_input
->textsize( 12 );
77 static void static_input_cb( Fl_Widget
*widget
, void *obj
)
79 ( ( NLE_Comments
* )obj
)->input_cb( ( Fl_Multiline_Input
* )widget
);
82 void input_cb( Fl_Multiline_Input
*input
)
84 NLE::Project( ).block( );
86 NLE::Project( ).set( "title", ( char * )input
->value( ) );
87 else if ( input
== project_input
)
88 NLE::Project( ).set( "nle_comments", ( char * )input
->value( ) );
89 else if ( input
== clip_input
)
90 current
->parent( ).set( "nle_comments", ( char * )input
->value( ) );
91 else if ( input
== cut_input
)
92 current
->set( "nle_comments", ( char * )input
->value( ) );
93 NLE::Project( ).unblock( );
103 title
->value( NLE::Project( ).get( "title" ) );
104 project_input
->value( NLE::Project( ).get( "nle_comments" ) );
105 project_input
->activate( );
107 catch( const char *e
)
110 project_input
->value( "" );
111 title
->deactivate( );
112 project_input
->deactivate( );
115 Producer
*clip
= NLE::Fetch_Selected( );
118 clip_input
->activate( );
119 current
= new Producer( clip
);
120 if ( current
->parent( ).get( "nle_comments" ) != NULL
)
121 clip_input
->value( ( char * )current
->parent( ).get( "nle_comments" ) );
123 clip_input
->value( "" );
125 if ( NLE::Current_Mode( ) == project_mode
)
127 cut_input
->activate( );
128 if ( current
->get( "nle_comments" ) != NULL
)
129 cut_input
->value( ( char * )current
->get( "nle_comments" ) );
131 cut_input
->value( "" );
135 cut_input
->deactivate( );
136 cut_input
->value( "" );
141 clip_input
->deactivate( );
142 clip_input
->value( "" );
143 cut_input
->deactivate( );
144 cut_input
->value( "" );
150 NLE_Panel
*shotcut::Panel_Comments( int x
, int y
, int w
, int h
)
152 return new NLE_Comments( x
, y
, w
, h
, "Comments" );