#include <RioMMTgif.h>
Inherits CRioMMSlideShow.
Public Member Functions | |
CRioMMTgif (char *, unsigned int, RioBlock, struct timeval RTT_average, int, int) | |
~CRioMMTgif (void) | |
int | init (void) |
int | Cleanup (void) |
void | Stop (void) |
void | setParent (int) |
int | ProcessSignal (int, void *) |
pid_t | GetTgifpid (void) |
Private Member Functions | |
bool | ChangeContext (const char *, int) |
void | SendCmd (const char *) |
void | ExecuteCallback (const char *) |
void | CreateBoxObjectCallback (int, int, int, int, int, int, int, const char *) |
void | CreateTextObjectCallback (int, int, int, int, const char *, const char *) |
void | SetObjectColorCallback (int, const char *) |
void | RotateObjectCallback (int, int) |
void | MoveObjectCallback (int, int, int) |
void | ResizeObjectCallback (int, int, int) |
void | RemoveObjectCallback (int) |
void | RemoveAllObjectsCallback (void) |
void | SyncSpecific (void) |
Private Attributes | |
pid_t | tgif_pid |
int | tgif_pipe [2] |
int | parentWindow |
int | screenWidth |
int | screenHeight |
TString | object_names [MAX_OBJECTS] |
Friends | |
void | tgif_execute_callback (void *, TQueue &) |
void | tgif_create_box_object_callback (void *, TQueue &) |
void | tgif_create_text_object_callback (void *, TQueue &) |
void | tgif_set_object_color_callback (void *, TQueue &) |
void | tgif_rotate_object_callback (void *, TQueue &) |
void | tgif_move_object_callback (void *, TQueue &) |
void | tgif_resize_object_callback (void *, TQueue &) |
void | tgif_remove_object_callback (void *, TQueue &) |
void | tgif_remove_all_objects_callback (void *, TQueue &) |
Definition at line 34 of file RioMMTgif.h.
CRioMMTgif::CRioMMTgif | ( | char * | VideoName, | |
unsigned int | blocksize, | |||
RioBlock | numBuffers, | |||
struct timeval | RTT_average, | |||
int | width, | |||
int | height | |||
) |
Definition at line 96 of file RioMMTgif.cpp.
00100 : CRioMMSlideShow( VideoName, blocksize, numBuffers , RTT_average ) 00101 { 00102 #ifdef RIO_DEBUG2 00103 RioErr << "[RioMMTgif]: Entrou no construtor " << endl; 00104 #endif 00105 00106 Major = 1; 00107 Minor = 0; 00108 tgif_pipe[0] = 0; 00109 tgif_pipe[1] = 0; 00110 tgif_pid = 0; 00111 parentWindow = 0; 00112 00113 screenWidth = width; 00114 screenHeight = height; 00115 00116 CommandsList = tgif_commands; 00117 NumberOfCommands = sizeof(tgif_commands) / sizeof(RioMMCommand); 00118 00119 #ifdef RIO_DEBUG2 00120 RioErr << "[RioMMTgif]: Achou " << NumberOfCommands << " comandos" << endl; 00121 RioErr << "[RioMMTgif]: Saindo do construtor" << endl; 00122 #endif 00123 }
CRioMMTgif::~CRioMMTgif | ( | void | ) |
Definition at line 126 of file RioMMTgif.cpp.
bool CRioMMTgif::ChangeContext | ( | const char * | file_name, | |
int | slide_number | |||
) | [private, virtual] |
Reimplemented from CRioMMSlideShow.
Definition at line 288 of file RioMMTgif.cpp.
00289 { 00290 #ifdef RIO_DEBUG2 00291 RioErr << "[RioMMTgif]: Entrando na ChangeContext" << endl; 00292 #endif 00293 00294 RemoveAllObjectsCallback(); 00295 if( tgif_pid <= 0 ) 00296 { 00297 RioErr << "Cannot changed context without TGIF" << endl; 00298 return false; 00299 } 00300 00301 if( TString( file_name ) != CurrentFileName ) 00302 { 00303 Command = "call_one_arg_shortcut(Open," + TempDirectory + "/" 00304 + TString( file_name ) + ")\n"; 00305 SendCmd( (const char *)Command ); 00306 } 00307 00308 Command.Format( "call_one_arg_shortcut(GotoPage,%d)\n", slide_number ); 00309 SendCmd( (const char *)Command ); 00310 00311 CRioMMSlideShow::ChangeContext( file_name, slide_number ); 00312 00313 #ifdef RIO_DEBUG2 00314 RioErr << "[RioMMTgif]: Saindo da ChangeContext " << endl; 00315 #endif 00316 00317 return true; 00318 }
int CRioMMTgif::Cleanup | ( | void | ) | [virtual] |
Implements CRioMMSlideShow.
Definition at line 244 of file RioMMTgif.cpp.
00245 { 00246 int status; 00247 00248 #ifdef RIO_DEBUG2 00249 RioErr << "[RioMMTgif]: Entrei na Cleanup" << endl; 00250 #endif 00251 00252 if( tgif_pid > 0 ) 00253 { 00254 /* Close TGIF */ 00255 SendCmd( "set_file_not_modified()\n" ); 00256 SendCmd( "call_simple_shortcut(Quit)\n" ); 00257 00258 kill( tgif_pid, SIGKILL ); 00259 tgif_pid = 0; 00260 00261 status = 1; 00262 } 00263 else 00264 status = 0; 00265 00266 #ifdef RIO_DEBUG2 00267 RioErr << "[RioMMTgif]: Saindo da Cleanup" << endl; 00268 #endif 00269 return status; 00270 }
void CRioMMTgif::CreateBoxObjectCallback | ( | int | oid, | |
int | type, | |||
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | lwidth, | |||
const char * | color | |||
) | [private] |
Definition at line 408 of file RioMMTgif.cpp.
00410 { 00411 struct timeval t; 00412 int side_size, head_size; 00413 00414 #ifdef RIO_DEBUG2 00415 RioErr << "[RioMMTgif]: Entrei na CreateBoxObjectCallback" << endl; 00416 #endif 00417 00418 if( tgif_pid <= 0 ) 00419 { 00420 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00421 return; 00422 } 00423 00424 if( oid >= MAX_OBJECTS || oid < 0 ) 00425 { 00426 RioErr << "Invalid object ID " << oid 00427 << ". Valid numbers are in the range of 0 to " 00428 << MAX_OBJECTS-1 << endl; 00429 return; 00430 } 00431 00432 if( (const char *)object_names[ oid ] != NULL ) 00433 { 00434 RioErr << "Cannot create a box object with ID " << oid 00435 << " because this number is already in use." << endl; 00436 return; 00437 } 00438 00439 if( x1 >= x2 || y1 >= y2 ) 00440 { 00441 RioErr << "Invalid coordinates for a box." << endl; 00442 return; 00443 } 00444 00445 gettimeofday( &t, NULL ); 00446 object_names[ oid ].Format( "hid%ld%ld", t.tv_sec, t.tv_usec ); 00447 00448 /* TGIF script */ 00449 SendCmd( "set_redraw(FALSE)\n" ); 00450 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00451 SendCmd( "unselect_all_obj()\n" ); 00452 SendCmd( "set_selected_obj_fill(0)\n" ); 00453 00454 /* Draw specific shape */ 00455 switch( type ) 00456 { 00457 case TGIF_BOX_OBJECT_RCBOX: 00458 Command.Format( "create_rcbox_obj(%d,%d,%d,%d)\n", 00459 x1, y1, x2, y2 ); 00460 SendCmd( (const char *)Command ); 00461 break; 00462 case TGIF_BOX_OBJECT_OVAL: 00463 Command.Format( "create_corner_oval_obj(%d,%d,%d,%d)\n", 00464 x1, y1, x2, y2 ); 00465 SendCmd( (const char *)Command ); 00466 break; 00467 case TGIF_BOX_OBJECT_ARROW: 00468 side_size = abs(y2-y1)/4; 00469 head_size = (2*abs(x2-x1))/5; 00470 SendCmd( "start_create_group_obj()\n" ); 00471 Command.Format( "create_first_vertex(%d,%d)\n", x1, y1+side_size ); 00472 SendCmd( (const char *)Command ); 00473 Command.Format( "create_next_vertex(%d,%d)\n", x2-head_size, 00474 y1+side_size ); 00475 SendCmd( (const char *)Command ); 00476 Command.Format( "create_next_vertex(%d,%d)\n", x2-head_size, y1 ); 00477 SendCmd( (const char *)Command ); 00478 Command.Format( "create_next_vertex(%d,%d)\n", x2, (y1+y2)/2 ); 00479 SendCmd( (const char *)Command ); 00480 Command.Format( "create_next_vertex(%d,%d)\n", x2-head_size, y2 ); 00481 SendCmd( (const char *)Command ); 00482 Command.Format( "create_next_vertex(%d,%d)\n", x2-head_size, 00483 y2-side_size ); 00484 SendCmd( (const char *)Command ); 00485 Command.Format( "create_next_vertex(%d,%d)\n", x1, y2-side_size ); 00486 SendCmd( (const char *)Command ); 00487 SendCmd( "create_polygon_obj()\n" ); 00488 SendCmd( "create_group_obj()\n" ); 00489 break; 00490 case TGIF_BOX_OBJECT_RECTANGLE: 00491 default: 00492 Command.Format( "create_box_obj(%d,%d,%d,%d)\n", 00493 x1, y1, x2, y2 ); 00494 SendCmd( (const char *)Command ); 00495 break; 00496 } 00497 00498 /* Select created object */ 00499 SendCmd( "select_top_obj()\n" ); 00500 00501 /* Add name attribute */ 00502 Command.Format( "add_attr_to_selected_obj(name,%s,NULL,NULL)\n", 00503 (const char *)object_names[ oid ] ); 00504 SendCmd( (const char *)Command ); 00505 00506 /* Hide name attribute */ 00507 Command.Format( "hide_attr(%s.name)\n", (const char*)object_names[oid] ); 00508 SendCmd( (const char *)Command ); 00509 00510 /* Set line width */ 00511 Command.Format( "set_selected_obj_line_width(%d,-1,-1)\n", lwidth ); 00512 SendCmd( (const char *)Command ); 00513 00514 /* Set color */ 00515 if( color && strlen(color) > 0 ) 00516 { 00517 Command.Format( "set_selected_obj_color(%s)\n", color ); 00518 SendCmd( (const char *)Command ); 00519 } 00520 else 00521 SendCmd( "set_selected_obj_color(black)\n" ); 00522 00523 SendCmd( "unselect_all_obj()\n" ); 00524 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00525 SendCmd( "set_redraw(TRUE)\n" ); 00526 00527 #ifdef RIO_DEBUG2 00528 RioErr << "[RioMMTgif]: Saindo da CreateBoxObjectCallback" << endl; 00529 #endif 00530 }
void CRioMMTgif::CreateTextObjectCallback | ( | int | oid, | |
int | x, | |||
int | y, | |||
int | size, | |||
const char * | color, | |||
const char * | text | |||
) | [private] |
Definition at line 540 of file RioMMTgif.cpp.
00542 { 00543 struct timeval t; 00544 00545 #ifdef RIO_DEBUG2 00546 RioErr << "[RioMMTgif]: Entrei na CreateTextObjectCallback" << endl; 00547 #endif 00548 00549 if( tgif_pid <= 0 ) 00550 { 00551 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00552 return; 00553 } 00554 00555 if( oid >= MAX_OBJECTS || oid < 0 ) 00556 { 00557 RioErr << "Invalid object ID " << oid 00558 << ". Valid numbers are in the range of 0 to " 00559 << MAX_OBJECTS-1 << endl; 00560 return; 00561 } 00562 00563 if( (const char *)object_names[ oid ] != NULL ) 00564 { 00565 RioErr << "Cannot create a text object object with ID " << oid 00566 << " because this number is already in use." << endl; 00567 return; 00568 } 00569 00570 if( text == NULL || strlen(text) < 1 ) 00571 { 00572 RioErr << "Cannot create an empty text object" << endl; 00573 return; 00574 } 00575 00576 gettimeofday( &t, NULL ); 00577 object_names[ oid ].Format( "hid%ld%ld", t.tv_sec, t.tv_usec ); 00578 00579 /* TGIF script */ 00580 SendCmd( "set_redraw(FALSE)\n" ); 00581 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00582 00583 /* Draw specific text */ 00584 SendCmd( "start_create_group_obj()\n" ); 00585 SendCmd( "create_box_obj(-2,-2,-1,-1)\n" ); 00586 Command.Format( "create_text_obj(%d,%d,%s)\n", x, y, text ); 00587 SendCmd( (const char *)Command ); 00588 SendCmd( "create_group_obj()\n" ); 00589 00590 /* Select created object */ 00591 SendCmd( "select_top_obj()\n" ); 00592 00593 /* Add name attribute */ 00594 Command.Format( "add_attr_to_selected_obj(name,%s,NULL,NULL)\n", 00595 (const char *)object_names[ oid ] ); 00596 SendCmd( (const char *)Command ); 00597 00598 /* Hide name attribute */ 00599 Command.Format( "hide_attr(%s.name)\n", (const char*)object_names[oid] ); 00600 SendCmd( (const char *)Command ); 00601 00602 /* Set justification */ 00603 Command.Format( "set_selected_text_size(%d)\n", size ); 00604 SendCmd( (const char *)Command ); 00605 SendCmd( "set_selected_text_just(left)\n" ); 00606 00607 /* Set color */ 00608 if( color && strlen(color) > 0 ) 00609 { 00610 Command.Format( "set_selected_obj_color(%s)\n", color ); 00611 SendCmd( (const char *)Command ); 00612 } 00613 else 00614 SendCmd( "set_selected_obj_color(black)\n" ); 00615 00616 SendCmd( "unselect_all_obj()\n" ); 00617 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00618 SendCmd( "set_redraw(TRUE)\n" ); 00619 00620 #ifdef RIO_DEBUG2 00621 RioErr << "[RioMMTgif]: Saindo da CreateTextObjectCallback" << endl; 00622 #endif 00623 }
void CRioMMTgif::ExecuteCallback | ( | const char * | command | ) | [private] |
Definition at line 377 of file RioMMTgif.cpp.
00378 { 00379 #ifdef RIO_DEBUG2 00380 RioErr << "[RioMMTgif]: Entrei na ExecuteCallback" << endl; 00381 #endif 00382 00383 if( tgif_pid <= 0 ) 00384 { 00385 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00386 return; 00387 } 00388 00389 if( command == NULL ) 00390 return; 00391 00392 SendCmd( command ); 00393 SendCmd( "\n" ); 00394 00395 #ifdef RIO_DEBUG2 00396 RioErr << "[RioMMTgif]: Saindo da ExecuteCallback " << endl; 00397 #endif 00398 }
pid_t CRioMMTgif::GetTgifpid | ( | void | ) |
Definition at line 900 of file RioMMTgif.cpp.
00901 { 00902 return tgif_pid; 00903 }
int CRioMMTgif::init | ( | void | ) | [virtual] |
Reimplemented from CRioMMSlideShow.
Definition at line 146 of file RioMMTgif.cpp.
00147 { 00148 int argc; 00149 char *argv[ 100 ]; 00150 char str_parentWindow[ 100 ]; 00151 char resolution[ 100 ]; 00152 00153 // Calculando posicionamento do TGIF automaticamente para qualquer resolu��o 00154 // de tela: 1024x768, 1280x1024, etc. 00155 sprintf( resolution , "762x695-%d-%d", screenWidth-685, screenHeight-546 ); 00156 00157 if( chdir( (const char *) TempDirectory ) == -1 ) 00158 { 00159 RioErr << "CRioMMTgif::init erro " << errno << "(" << strerror( errno ) 00160 << ") ao mudar (chdir) para o diretorio" << TempDirectory 00161 << endl; 00162 } 00163 00164 /* Building command line */ 00165 sprintf( str_parentWindow, "%d", parentWindow ); 00166 argc = 0; 00167 argv[ argc++ ] = strdup( "tgif" ); 00168 argv[ argc++ ] = strdup( "-parent" ); 00169 argv[ argc++ ] = strdup( str_parentWindow ); 00170 argv[ argc++ ] = strdup( "-hyper" ); 00171 argv[ argc++ ] = strdup( "-geometry" ); 00172 argv[ argc++ ] = resolution; 00173 argv[ argc++ ] = strdup( "-xrm" ); 00174 argv[ argc++ ] = strdup( "Tgif.AllowLaunchInHyperSpace: true" ); 00175 argv[ argc++ ] = strdup( "-xrm" ); 00176 argv[ argc++ ] = strdup( "Tgif.CanvasWindowOnly: true" ); 00177 argv[ argc++ ] = strdup( "-xrm" ); 00178 argv[ argc++ ] = strdup( "Tgif.InitialShowGrid: false" ); 00179 argv[ argc++ ] = strdup( "-xrm" ); 00180 argv[ argc++ ] = strdup( "Tgif.Btn2PopupMainMenu: false" ); 00181 argv[ argc++ ] = strdup( "-xrm" ); 00182 argv[ argc++ ] = strdup( "Tgif.EnableMouseWheel: false" ); 00183 00184 argv[ argc++ ] = strdup( "-exec" ); 00185 argv[ argc++ ] = strdup( "-" ); 00186 argv[ argc++ ] = NULL; 00187 00188 /* Creating the communication pipe */ 00189 if( pipe( tgif_pipe ) < 0 ) 00190 { 00191 Rioperror( "pipe" ); 00192 return( 0 ); 00193 } 00194 if( dup2( tgif_pipe[ 0 ], 0 ) == -1 ) 00195 { 00196 Rioperror( "dup2" ); 00197 return( 0 ); 00198 } 00199 00200 if( (tgif_pid = fork()) != 0 ) 00201 { 00202 if( tgif_pid < 0 ) 00203 { 00204 Rioperror( "fork" ); 00205 return( 0 ); 00206 } 00207 } 00208 else 00209 { 00210 int null_file; 00211 /* redirecting stdout to /dev/null */ 00212 null_file = open( "/dev/null", O_WRONLY ); 00213 if( null_file > 0 ) 00214 dup2( null_file, 1 ); 00215 00216 if( execvp( argv[ 0 ], argv ) < 0 ) 00217 { 00218 Rioperror( "execvp" ); 00219 exit( 1 ); 00220 } 00221 } 00222 00223 /* Give a little time to be sure tgif is already running */ 00224 sleep( 1 ); 00225 00226 SyncSpecific(); 00227 00228 //Instancia-se esta vari�vel RioBlock como par�metro para o SyncMedia 00229 RioBlock block = 1; 00230 00231 //Esta chamada ao m�todo SyncMedia � realizada para que os slides do TGIF 00232 //sejam carregados o mais cedo poss�vel 00233 SyncMedia( (void *)block ); 00234 00235 return CRioMMSlideShow::init(); 00236 }
void CRioMMTgif::MoveObjectCallback | ( | int | oid, | |
int | x, | |||
int | y | |||
) | [private] |
Definition at line 732 of file RioMMTgif.cpp.
00733 { 00734 #ifdef RIO_DEBUG2 00735 RioErr << "[RioMMTgif]: Entrei na MoveObjectCallback" << endl; 00736 #endif 00737 00738 if( tgif_pid <= 0 ) 00739 { 00740 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00741 return; 00742 } 00743 00744 if( oid >= MAX_OBJECTS || oid < 0 ) 00745 { 00746 RioErr << "Invalid object ID " << oid 00747 << ". Valid numbers are in the range of 0 to " 00748 << MAX_OBJECTS-1 << endl; 00749 return; 00750 } 00751 00752 if( (const char *)object_names[ oid ] == NULL ) 00753 { 00754 RioErr << "Cannot move object with ID " << oid 00755 << " because it was not created yet." << endl; 00756 return; 00757 } 00758 00759 // TGIF script 00760 SendCmd( "set_redraw(FALSE)\n" ); 00761 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00762 Command = "select_obj_by_name(" + object_names[ oid ] + ")\n"; 00763 SendCmd( (const char *)Command ); 00764 Command.Format( "move_selected_obj_absolute(%d,%d)\n", x, y ); 00765 SendCmd( (const char *)Command ); 00766 SendCmd( "unselect_all_obj()\n" ); 00767 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00768 SendCmd( "set_redraw(TRUE)\n" ); 00769 00770 #ifdef RIO_DEBUG2 00771 RioErr << "[RioMMTgif]: Saindo da MoveObjectCallback " << endl; 00772 #endif 00773 }
int CRioMMTgif::ProcessSignal | ( | int | sig, | |
void * | data | |||
) | [virtual] |
Reimplemented from CRioMMObject.
Definition at line 353 of file RioMMTgif.cpp.
00354 { 00355 int status; 00356 00357 status = 0; 00358 switch( sig ) 00359 { 00360 case SIGCHLD: 00361 if( (int) (long long int) data == tgif_pid ) 00362 status = 2; 00363 break; 00364 } 00365 00366 if( status != 2 ) 00367 CRioMMObject::ProcessSignal( sig, data ); 00368 00369 return( status ); 00370 }
void CRioMMTgif::RemoveAllObjectsCallback | ( | void | ) | [private] |
Definition at line 876 of file RioMMTgif.cpp.
00877 { 00878 int i; 00879 00880 #ifdef RIO_DEBUG2 00881 RioErr << "[RioMMTgif]: Entrei na RemoveAllObjectsCallback" << endl; 00882 #endif 00883 if( tgif_pid <= 0 ) 00884 { 00885 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00886 return; 00887 } 00888 00889 for( i = 0; i < MAX_OBJECTS; i++ ) 00890 { 00891 if( (const char *)object_names[ i ] != NULL ) 00892 RemoveObjectCallback( i ); 00893 } 00894 00895 #ifdef RIO_DEBUG2 00896 RioErr << "[RioMMTgif]: Saindo da RemoveAllObjectsCallback " << endl; 00897 #endif 00898 }
void CRioMMTgif::RemoveObjectCallback | ( | int | oid | ) | [private] |
Definition at line 827 of file RioMMTgif.cpp.
00828 { 00829 #ifdef RIO_DEBUG2 00830 RioErr << "[RioMMTgif]: Entrei na RemoveObjectCallback" << endl; 00831 #endif 00832 00833 if( tgif_pid <= 0 ) 00834 { 00835 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00836 return; 00837 } 00838 00839 if( oid >= MAX_OBJECTS || oid < 0 ) 00840 { 00841 RioErr << "Invalid object ID " << oid 00842 << ". Valid numbers are in the range of 0 to " 00843 << MAX_OBJECTS-1 << endl; 00844 return; 00845 } 00846 00847 if( (const char *)object_names[ oid ] == NULL ) 00848 { 00849 RioErr << "Cannot remove object with ID " << oid 00850 << " because it was not created yet." << endl; 00851 return; 00852 } 00853 00854 // TGIF script 00855 SendCmd( "set_redraw(FALSE)\n" ); 00856 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00857 Command = "select_obj_by_name(" + object_names[ oid ] + ")\n"; 00858 SendCmd( (const char *)Command ); 00859 SendCmd( "delete_selected_obj()\n" ); 00860 SendCmd( "unselect_all_obj()\n" ); 00861 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00862 SendCmd( "set_redraw(TRUE)\n" ); 00863 00864 object_names[ oid ] = NULL; 00865 00866 #ifdef RIO_DEBUG2 00867 RioErr << "[RioMMTgif]: Saindo da RemoveObjectCallback" << endl; 00868 #endif 00869 }
void CRioMMTgif::ResizeObjectCallback | ( | int | oid, | |
int | w, | |||
int | h | |||
) | [private] |
Definition at line 780 of file RioMMTgif.cpp.
00781 { 00782 #ifdef RIO_DEBUG2 00783 RioErr << "[RioMMTgif]: Entrei na ResizeObjectCallback" << endl; 00784 #endif 00785 00786 if( tgif_pid <= 0 ) 00787 { 00788 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00789 return; 00790 } 00791 00792 if( oid >= MAX_OBJECTS || oid < 0 ) 00793 { 00794 RioErr << "Invalid object ID " << oid 00795 << ". Valid numbers are in the range of 0 to " 00796 << MAX_OBJECTS-1 << endl; 00797 return; 00798 } 00799 00800 if( (const char *)object_names[ oid ] == NULL ) 00801 { 00802 RioErr << "Cannot resize object with ID " << oid 00803 << " because it was not created yet." << endl; 00804 return; 00805 } 00806 00807 // TGIF script 00808 SendCmd( "set_redraw(FALSE)\n" ); 00809 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00810 Command.Format( "size_named_obj_absolute(%s,%d,%d)\n", 00811 (const char *)object_names[ oid ], w, h ); 00812 SendCmd( (const char *)Command ); 00813 SendCmd( "unselect_all_obj()\n" ); 00814 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00815 SendCmd( "set_redraw(TRUE)\n" ); 00816 00817 #ifdef RIO_DEBUG2 00818 RioErr << "[RioMMTgif]: Saindo da ResizeObjectCallback " << endl; 00819 #endif 00820 }
void CRioMMTgif::RotateObjectCallback | ( | int | oid, | |
int | angle | |||
) | [private] |
Definition at line 684 of file RioMMTgif.cpp.
00685 { 00686 #ifdef RIO_DEBUG2 00687 RioErr << "[RioMMTgif]: Entrei na MoveObjectCallback" << endl; 00688 #endif 00689 00690 if( tgif_pid <= 0 ) 00691 { 00692 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00693 return; 00694 } 00695 00696 if( oid >= MAX_OBJECTS || oid < 0 ) 00697 { 00698 RioErr << "Invalid object ID " << oid 00699 << ". Valid numbers are in the range of 0 to " 00700 << MAX_OBJECTS-1 << endl; 00701 return; 00702 } 00703 00704 if( (const char *)object_names[ oid ] == NULL ) 00705 { 00706 RioErr << "Cannot rotate object with ID " << oid 00707 << " because it was not created yet." << endl; 00708 return; 00709 } 00710 00711 // TGIF script 00712 SendCmd( "set_redraw(FALSE)\n" ); 00713 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00714 Command = "select_obj_by_name(" + object_names[ oid ] + ")\n"; 00715 SendCmd( (const char *)Command ); 00716 Command.Format( "rotate_selected_obj(%d)\n", angle ); 00717 SendCmd( (const char *)Command ); 00718 SendCmd( "unselect_all_obj()\n" ); 00719 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00720 SendCmd( "set_redraw(TRUE)\n" ); 00721 00722 #ifdef RIO_DEBUG2 00723 RioErr << "[RioMMTgif]: Saindo da MoveObjectCallback " << endl; 00724 #endif 00725 }
void CRioMMTgif::SendCmd | ( | const char * | command | ) | [private] |
Definition at line 326 of file RioMMTgif.cpp.
00327 { 00328 int escritos; 00329 escritos = write( tgif_pipe[ 1 ], command, strlen( command ) ); 00330 00331 if( escritos != (int) strlen( command ) ) 00332 { 00333 RioErr << "CRioMMTgif::SendCmd erro ao escrever o valor de command: " 00334 << "escritos "<< escritos << " bytes de um total de" 00335 << strlen( command ) << " bytes." << endl; 00336 } 00337 else if( escritos == -1 ) 00338 { 00339 RioErr << "CRioMMTgif::SendCmd erro " << errno << "(" 00340 << strerror( errno ) << ") ao escrever o valor de command." 00341 << endl; 00342 } 00343 00344 usleep( 1 ); 00345 }
void CRioMMTgif::SetObjectColorCallback | ( | int | oid, | |
const char * | color | |||
) | [private] |
Definition at line 630 of file RioMMTgif.cpp.
00631 { 00632 #ifdef RIO_DEBUG2 00633 RioErr << "[RioMMTgif]: Entrei na MoveObjectCallback" << endl; 00634 #endif 00635 00636 if( tgif_pid <= 0 ) 00637 { 00638 RioErr << "Cannot send commands to tgif: broken pipe" << endl; 00639 return; 00640 } 00641 00642 if( oid >= MAX_OBJECTS || oid < 0 ) 00643 { 00644 RioErr << "Invalid object ID " << oid 00645 << ". Valid numbers are in the range of 0 to " 00646 << MAX_OBJECTS-1 << endl; 00647 return; 00648 } 00649 00650 if( (const char *)object_names[ oid ] == NULL ) 00651 { 00652 RioErr << "Cannot set the color for object with ID " << oid 00653 << " because it was not created yet." << endl; 00654 return; 00655 } 00656 00657 if( color == NULL || strlen(color) < 1 ) 00658 { 00659 RioErr << "Invalid color" << endl; 00660 return; 00661 } 00662 00663 // TGIF script 00664 SendCmd( "set_redraw(FALSE)\n" ); 00665 SendCmd( "set_allow_interrupt(FALSE)\n" ); 00666 Command = "select_obj_by_name(" + object_names[ oid ] + ")\n"; 00667 SendCmd( (const char *)Command ); 00668 Command.Format( "set_selected_obj_color(%s)\n", color ); 00669 SendCmd( (const char *)Command ); 00670 SendCmd( "unselect_all_obj()\n" ); 00671 SendCmd( "set_allow_interrupt(TRUE)\n" ); 00672 SendCmd( "set_redraw(TRUE)\n" ); 00673 00674 #ifdef RIO_DEBUG2 00675 RioErr << "[RioMMTgif]: Saindo da MoveObjectCallback " << endl; 00676 #endif 00677 }
void CRioMMTgif::setParent | ( | int | window | ) |
Definition at line 140 of file RioMMTgif.cpp.
00141 { 00142 parentWindow = window; 00143 }
void CRioMMTgif::Stop | ( | void | ) | [virtual] |
Reimplemented from CRioMMSlideShow.
Definition at line 273 of file RioMMTgif.cpp.
00274 { 00275 #ifdef RIO_DEBUG2 00276 RioErr << "[RioMMTgif]: Entrei na Stop" << endl; 00277 #endif 00278 00279 SendCmd( "set_file_not_modified()\n" ); 00280 00281 CRioMMSlideShow::Stop(); 00282 00283 #ifdef RIO_DEBUG2 00284 RioErr << "[RioMMTgif]: Saindo da Stop" << endl; 00285 #endif 00286 }
void CRioMMTgif::SyncSpecific | ( | void | ) | [private, virtual] |
void tgif_create_box_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 922 of file RioMMTgif.cpp.
00923 { 00924 int arg[ 7 ]; 00925 TString * arg8; 00926 00927 arg[ 0 ] = (int) (long long int) args.Remove( ); 00928 arg[ 1 ] = (int) (long long int) args.Remove( ); 00929 arg[ 2 ] = (int) (long long int) args.Remove( ); 00930 arg[ 3 ] = (int) (long long int) args.Remove( ); 00931 arg[ 4 ] = (int) (long long int) args.Remove( ); 00932 arg[ 5 ] = (int) (long long int) args.Remove( ); 00933 arg[ 6 ] = (int) (long long int) args.Remove( ); 00934 arg8 = (TString *)args.Remove( ); 00935 00936 ((CRioMMTgif *)param)->CreateBoxObjectCallback( arg[ 0 ], arg[ 1 ], 00937 arg[ 2 ], arg[ 3 ], arg[ 4 ], arg[ 5 ], 00938 arg[ 6 ], (const char *)*arg8 ); 00939 00940 delete arg8; 00941 }
void tgif_create_text_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 943 of file RioMMTgif.cpp.
00944 { 00945 int arg[ 4 ]; 00946 TString * arg5, * arg6; 00947 00948 arg[ 0 ] = (int) (long long int) args.Remove( ); 00949 arg[ 1 ] = (int) (long long int) args.Remove( ); 00950 arg[ 2 ] = (int) (long long int) args.Remove( ); 00951 arg[ 3 ] = (int) (long long int) args.Remove( ); 00952 arg5 = (TString *)args.Remove( ); 00953 arg6 = (TString *)args.Remove( ); 00954 00955 ((CRioMMTgif *)param)->CreateTextObjectCallback( arg[ 0 ], arg[ 1 ], 00956 arg[ 2 ], arg[ 3 ], (const char *)*arg5, (const char *)*arg6 ); 00957 00958 delete arg5; 00959 delete arg6; 00960 }
void tgif_execute_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 911 of file RioMMTgif.cpp.
00912 { 00913 TString * arg1; 00914 00915 arg1 = (TString *)args.Remove( ); 00916 00917 ((CRioMMTgif *)param)->ExecuteCallback( (const char *)*arg1 ); 00918 00919 delete arg1; 00920 }
void tgif_move_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 986 of file RioMMTgif.cpp.
00987 { 00988 int arg[ 3 ]; 00989 00990 arg[ 0 ] = (int) (long long int) args.Remove( ); 00991 arg[ 1 ] = (int) (long long int) args.Remove( ); 00992 arg[ 2 ] = (int) (long long int) args.Remove( ); 00993 00994 ((CRioMMTgif *)param)->MoveObjectCallback( arg[ 0 ], arg[ 1 ], 00995 arg[ 2 ] ); 00996 }
void tgif_remove_all_objects_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 1019 of file RioMMTgif.cpp.
01020 { 01021 ((CRioMMTgif *)param)->RemoveAllObjectsCallback( ); 01022 }
void tgif_remove_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 1010 of file RioMMTgif.cpp.
01011 { 01012 int arg1; 01013 01014 arg1 = (int) (long long int) args.Remove( ); 01015 01016 ((CRioMMTgif *)param)->RemoveObjectCallback( arg1 ); 01017 }
void tgif_resize_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 998 of file RioMMTgif.cpp.
00999 { 01000 int arg[ 3 ]; 01001 01002 arg[ 0 ] = (int) (long long int) args.Remove( ); 01003 arg[ 1 ] = (int) (long long int) args.Remove( ); 01004 arg[ 2 ] = (int) (long long int) args.Remove( ); 01005 01006 ((CRioMMTgif *)param)->ResizeObjectCallback( arg[ 0 ], arg[ 1 ], 01007 arg[ 2 ] ); 01008 }
void tgif_rotate_object_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 976 of file RioMMTgif.cpp.
00977 { 00978 int arg[ 2 ]; 00979 00980 arg[ 0 ] = (int) (long long int) args.Remove( ); 00981 arg[ 1 ] = (int) (long long int) args.Remove( ); 00982 00983 ((CRioMMTgif *)param)->RotateObjectCallback( arg[ 0 ], arg[ 1 ] ); 00984 }
void tgif_set_object_color_callback | ( | void * | param, | |
TQueue & | args | |||
) | [friend] |
Definition at line 962 of file RioMMTgif.cpp.
00963 { 00964 int arg1; 00965 TString * arg2; 00966 00967 arg1 = (int) (long long int) args.Remove( ); 00968 arg2 = (TString *)args.Remove( ); 00969 00970 ((CRioMMTgif *)param)->SetObjectColorCallback( arg1, 00971 (const char *)*arg2 ); 00972 00973 delete arg2; 00974 }
TString CRioMMTgif::object_names[MAX_OBJECTS] [private] |
Definition at line 42 of file RioMMTgif.h.
int CRioMMTgif::parentWindow [private] |
Definition at line 39 of file RioMMTgif.h.
int CRioMMTgif::screenHeight [private] |
Definition at line 41 of file RioMMTgif.h.
int CRioMMTgif::screenWidth [private] |
Definition at line 40 of file RioMMTgif.h.
pid_t CRioMMTgif::tgif_pid [private] |
Definition at line 37 of file RioMMTgif.h.
int CRioMMTgif::tgif_pipe[2] [private] |
Definition at line 38 of file RioMMTgif.h.