Changeset 1690 for trunk/MagicSoft/Cosy/gui/MGImage.cc
- Timestamp:
- 12/18/02 17:48:44 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/gui/MGImage.cc
r1343 r1690 11 11 #include <iostream.h> 12 12 #include <pthread.h> 13 14 #include <TTimer.h> 15 #include <TSystem.h> 16 #include <TVirtualX.h> 17 #include <TGX11.h> 13 18 14 19 ClassImp(MGImage); … … 97 102 98 103 // 99 // get frame id100 //101 fId = GetId();102 103 //104 104 // Create Default Graphic Context (XCreateGC) 105 105 // 106 fDefGC = gVirtualX->CreateGC(fId, 0); // GetBckgndGC() ; //106 fDefGC = gVirtualX->CreateGC(fId, 0); // GetBckgndGC().GetGC(); // 107 107 108 108 // … … 120 120 121 121 Resize(w, h); 122 123 //fTimer=new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 250, kTRUE); 124 // fTimer=new TTimer("printf(\"Timer!\\n\"); gSystem->ProcessEvents();", 250, kTRUE); 125 //fTimer->Start(); 122 126 } 123 127 124 128 void MGImage::Resize(UInt_t w, UInt_t h) 125 129 { 126 TGFrame::Resize(w+2*GetBorderWidth(), h+2*GetBorderWidth());130 // TGFrame::Resize(w+2*GetBorderWidth(), h+2*GetBorderWidth()); 127 131 // FIXME: RESIZE THE PIXMAP 128 132 } … … 130 134 void MGImage::Resize(TGDimension size) 131 135 { 132 TGFrame::Resize(size.fWidth+2*GetBorderWidth(), size.fHeight+2*GetBorderWidth());136 // TGFrame::Resize(size.fWidth+2*GetBorderWidth(), size.fHeight+2*GetBorderWidth()); 133 137 // FIXME: RESIZE THE PIXMAP 134 138 } … … 136 140 void MGImage::MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h) 137 141 { 138 TGFrame::MoveResize(x, y, w+2*GetBorderWidth(), h+2*GetBorderWidth());142 // TGFrame::MoveResize(x, y, w+2*GetBorderWidth(), h+2*GetBorderWidth()); 139 143 // FIXME: RESIZE THE PIXMAP 140 144 } … … 142 146 MGImage::~MGImage() 143 147 { 148 //fTimer->Stop(); 149 //delete fTimer; 150 144 151 pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap); 145 152 … … 154 161 155 162 if (fPixmap!=kNone) // @@@ 163 { 164 cout << "Delete Pixmap" << endl; 156 165 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap); 166 } 157 167 158 168 cout << "Deleting GC..." << endl; 159 169 170 160 171 gVirtualX->DeleteGC(fDefGC); // XFreeGC(fDisplay, (GC) gc); 161 172 … … 165 176 } 166 177 178 #include <X11/Xlib.h> 167 179 /* 168 #include <X11/Xlib.h>169 180 #include <X11/Xutil.h> 170 181 #include <X11/Intrinsic.h> … … 174 185 void MGImage::DoRedraw() 175 186 { 176 // Pixmap_t pm = gVirtualX->CreatePixmap(this->GetId(), buffer, 177 // 768, 576, 0, 0xff, 8); 178 TGFrame::DrawBorder(); 187 // TGFrame::DrawBorder(); 179 188 pthread_mutex_lock((pthread_mutex_t*)fMuxPixmap); 189 190 //=========================== 191 if (TestBit(kNeedRecreate)) 192 { 193 Pixmap_t mask = kNone; 194 PictureAttributes_t attr; 195 attr.fMask = kNone; 196 197 if (fPixmap!=kNone) 198 gVirtualX->DeletePixmap(fPixmap); 199 200 fPixmap=kNone; 201 202 if (!gVirtualX->CreatePictureFromData(fId, fBuffer, fPixmap, 203 mask, attr)) 204 { 205 cout << "Warning: Error in CreatePictureFromData" << endl; 206 fPixmap=kNone; 207 } 208 ResetBit(kNeedRecreate); 209 } 210 211 //=========================== 180 212 181 213 // Copy a drawable (i.e. pixmap) to another drawable (pixmap, window). … … 185 217 // dest_x, dest_y); 186 218 if (fPixmap!=kNone) //@@@ 187 gVirtualX->CopyArea(fPixmap, fId, fDefGC, 188 0, 0, fWidth, fHeight, 189 GetBorderWidth(), GetBorderWidth()); 219 { 220 // gVirtualX->DrawString(fId, fDefGC, 20, 20, "HELLO WORLD!", 12); 221 // gVirtualX->FillRectangle(fId, fDefGC, 10, 10, 50, 50); 222 223 // cout << gVirtualX->IsA()->GetName() << endl; 224 gVirtualX->CopyArea(fPixmap, fId, fDefGC, 225 0, 0, fWidth, fHeight, 226 GetBorderWidth(), GetBorderWidth()); 227 228 /* 229 XCopyArea((Display*)gVirtualX->GetDisplay(), pm, fId, 230 (GC)fDefGC, 0, 0, fWidth, fHeight, 231 GetBorderWidth(), GetBorderWidth()); 232 */ 233 } 190 234 /* 191 235 if (fPix) … … 271 315 cout << "Done " << (void*)fPix << endl; 272 316 */ 317 318 /* 273 319 Pixmap_t mask = kNone; 274 320 PictureAttributes_t attr; 275 321 attr.fMask = kNone; 276 322 if (fPixmap!=kNone) // @@@ 277 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap);323 gVirtualX->DeletePixmap(fPixmap); // XFreePixmap(fDisplay, (Pixmap) pmap); 278 324 279 325 // Create a pixture pixmap from data. The picture attributes … … 310 356 fPixmap=kNone; 311 357 } 312 358 */ 359 SetBit(kNeedRecreate); 313 360 pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap); 314 DoRedraw(); 361 //gClient->NeedRedraw(this); 362 //fTimer->Start(10, kTRUE); 363 //gVirtualX->UpdateWindow(1); 364 // ((TGX11*)gVirtualX)->Sync(1); 365 //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE); 366 // DoRedraw(); 315 367 } 316 368 … … 339 391 } 340 392 } 341 393 /* 342 394 Pixmap_t mask = kNone; 343 395 PictureAttributes_t attr; … … 346 398 if (fPixmap!=kNone) 347 399 gVirtualX->DeletePixmap(fPixmap); 400 348 401 fPixmap=kNone; 349 402 … … 354 407 fPixmap=kNone; 355 408 } 356 409 */ 410 SetBit(kNeedRecreate); 357 411 pthread_mutex_unlock((pthread_mutex_t*)fMuxPixmap); 358 DoRedraw(); 359 } 360 412 //gClient->NeedRedraw(this); 413 //fTimer->Start(10, kTRUE); 414 //gVirtualX->UpdateWindow(1); 415 // ((TGX11*)gVirtualX)->Sync(1); 416 //new TTimer(Form("gClient->ProcessEventsFor((TGWindow*)0x%p);", this), 1, kFALSE); 417 // DoRedraw(); 418 } 419
Note:
See TracChangeset
for help on using the changeset viewer.