Пример #1
0
void EditorWidget::paintEvent( QPaintEvent *e ){
  if(ATOMIC_GET(is_starting_up)==true)
    return;

  //static int n=0;  printf("** Drawing up everything! %d\n",n++);
  
  GFX_clear_op_queue(this->window);

  g_allowed_to_grow_queue = true;
  DO_GFX(DrawUpTrackerWindow(this->window));
  g_allowed_to_grow_queue = false;
  
  if(GFX_get_op_queue_size(this->window) > 0){
    QPainter paint(this);

    this->painter = &paint;
    //this->painter->setFont(this->font);
    
    {
      GFX_play_op_queue(this->window);
      //GFX_clear_op_queue(this->window);
    }
    
    this->painter = NULL;
  }
}
Пример #2
0
void TrackSelectUpdate(struct Tracker_Windows *window,struct WBlocks *wblock,int ret){

	switch(ret){
		case 0:
			return;
		case 1:
			R_SetCursorPos(window);
			break;
		case 2:
                  window->must_redraw = true;
#if 0
		  UpdateWBlockCoordinates(window,wblock);
		  DrawUpAllWTracks(window,wblock,NULL);
		  DrawAllWTrackHeaders(window,wblock);

                  {
                    struct WTracks *wtrack2=ListLast1(&wblock->wtracks->l);
                    if(wtrack2->fxarea.x2<wblock->a.x2){
                      GFX_FilledBox(window,0,wtrack2->fxarea.x2+2,wblock->t.y1,wblock->a.x2,wblock->t.y2,PAINT_BUFFER);
                      GFX_FilledBox(window,0,wtrack2->fxarea.x2+2,0,wblock->a.x2,wblock->t.y1,PAINT_DIRECTLY);
                    }
                  }

		  DrawBottomSlider(window);
                  DrawUpTrackerWindow(window);
#endif
                  break;
	}

        GFX_update_instrument_patch_gui(wblock->wtrack->track->patch);
        DrawAllWTrackHeaders(window,wblock);

        window->must_redraw=true;
}
Пример #3
0
void testColorInRealtime(int num, QColor color){
  if(num>=16)
    return;

  struct Tracker_Windows *window = root->song->tracker_windows;
  EditorWidget *my_widget=(EditorWidget *)window->os_visual.widget;
  setColor(my_widget,num,color.rgb());
  updateAll(my_widget);

  if(false && num==0)
    my_widget->repaint(); // todo: fix flicker.
  else{
    // Doesn't draw everything.
    DO_GFX({
        DrawUpTrackerWindow(window);
      });
    my_widget->updateEditor();
  }
Пример #4
0
void testColorInRealtime(enum ColorNums num, QColor color){
  R_ASSERT_RETURN_IF_FALSE(num<END_CONFIG_COLOR_NUM);

  struct Tracker_Windows *window = root->song->tracker_windows;
  EditorWidget *my_widget=(EditorWidget *)window->os_visual.widget;
  setColor(num,color.rgb());
  updateAll(my_widget);

  if(false && num==0)
    my_widget->repaint(); // todo: fix flicker.
  else{
    // Doesn't draw everything.
    DO_GFX({
        DrawUpTrackerWindow(window);
      });
    //GL_create(window, window->wblock);
    my_widget->updateEditor();
  }
Пример #5
0
static void update_font(void){
  const char *new_font_name = gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog*)font_selector);
  struct Tracker_Windows *window=root->song->tracker_windows;

  pango_font_description_free(font_description);
  font_description = pango_font_description_from_string(new_font_name);
#if FONT_THICKNESS_CONFIG
  pango_font_description_set_weight(font_description, font_thickness);
#endif

  pango_layout_set_font_description (pango_layout, font_description);

  setFontValues(window);
      
  printf("new_font_name: \"%s\". font_name: \"%s\". height: %d, width: %d\n",new_font_name,font_name,window->fontheight,window->fontwidth);
  font_name = new_font_name;
  DO_GFX_BLT({
      UpdateAllWBlockWidths(window);
      DrawUpTrackerWindow(window);
    });
Пример #6
0
static bool Load_CurrPos_org(struct Tracker_Windows *window, const wchar_t *filename){
	bool ret = false;

        // So many things happen here, that we should turn off garbage collection while loading.
        //
        // For instance, the instrument widget contains pointers (which are unreachable from the GC) to Patch
        // and PatchData objects. The instrument widget is updated after setting a new root, so it may access
        // that memory while a new song is loaded (since we don't have control over what Qt may do while we
        // access it). Not unlikely to be other similar situations.
        if(0){
          GC_disable();
        }


	PlayStop();

        if(Undo_are_you_shure_questionmark()==false)
          goto exit;

        if(filename==NULL)
          filename=GFX_GetLoadFileName(window,NULL,"Select file to load", NULL, NULL);

	if(filename==NULL) goto exit;

        if (STRING_ends_with(filename,".MMD2") ||
            STRING_ends_with(filename,".MMD3") ||
            STRING_ends_with(filename,".MMD") ||
            STRING_ends_with(filename,".mmd2") ||
            STRING_ends_with(filename,".mmd3") ||
            STRING_ends_with(filename,".mmd")
            )
          {

            mmp2filename=filename;
            ret = Load(STRING_create("new_song.rad"));

          } else {

            OS_set_loading_path(filename);
            {
              ret = Load(filename);
            }
            OS_unset_loading_path();
            
            GFX_SetWindowTitle(root->song->tracker_windows, filename);
            
            GFX_EditorWindowToFront(root->song->tracker_windows);
            
            struct WBlocks *wblock = root->song->tracker_windows->wblock;
            GFX_update_instrument_patch_gui(wblock->wtrack->track->patch);
            
            DrawUpTrackerWindow(root->song->tracker_windows);
            
            fprintf(stderr,"Got here (loading finished)\n");
        }

 exit:

        if(0){
          GC_enable();
        }

	if(mmp2filename!=NULL) {
          LoadMMP2(root->song->tracker_windows, mmp2filename);
          mmp2filename=NULL;
        }

        if (ret)
          ResetUndo();
        
        return ret;
}