Esempio n. 1
0
void CDialogBarEx::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	//在停靠时才绘制
	if(!this->IsFloating())
		PaintTitle(&dc);

	// Do not call CDialogBar::OnPaint() for painting messages
}
Esempio n. 2
0
void
InfoBoxWindow::Paint(Canvas &canvas)
{
  const Color background_color = pressed
    ? look.pressed_background_color
    : (HasFocus() || dragging || force_draw_selector
       ? look.focused_background_color
       : look.background_color);
  if (settings.border_style == InfoBoxSettings::BorderStyle::GLASS)
    DrawGlassBackground(canvas, canvas.GetRect(), background_color);
  else
    canvas.Clear(background_color);

  if (data.GetCustom() && content != NULL) {
    /* if there's no comment, the content object may paint that area,
       too */
    const PixelRect &rc = data.comment.empty()
      ? value_and_comment_rect
      : value_rect;
    content->OnCustomPaint(canvas, rc);
  }

  canvas.SetBackgroundTransparent();

  PaintTitle(canvas);
  PaintComment(canvas);
  PaintValue(canvas, background_color);

  if (border_kind != 0) {
    canvas.Select(look.border_pen);

    const unsigned width = canvas.GetWidth(),
      height = canvas.GetHeight();

    if (border_kind & BORDERTOP) {
      canvas.DrawExactLine(0, 0, width - 1, 0);
    }

    if (border_kind & BORDERRIGHT) {
      canvas.DrawExactLine(width - 1, 0, width - 1, height);
    }

    if (border_kind & BORDERBOTTOM) {
      canvas.DrawExactLine(0, height - 1, width - 1, height - 1);
    }

    if (border_kind & BORDERLEFT) {
      canvas.DrawExactLine(0, 0, 0, height - 1);
    }
  }
}
Esempio n. 3
0
void BeyeContext::main_loop()
{
    __filesize_t OldCurrFilePos; /** means previous File position */
    int ch;
    __filesize_t savep = 0,cfp,nfp,flen;
    unsigned long lwidth;
    plugin_position rc;
    Search& s = search();
    bm_file().seek(LastOffset,binary_stream::Seek_Set);
    drawPrompt();
    rc.textshift=0;
    rc = active_mode().paint(KE_SUPERKEY,rc.textshift);
    bm_file().seek(LastOffset,binary_stream::Seek_Set);
    draw_title(rc.lastbyte);
    while(1) {
        unsigned che;
        ch = GetEvent(drawPrompt,MainActionFromMenu,NULL);
        nfp = cfp = OldCurrFilePos = tell();
        flen = flength();
        lwidth = active_mode().curr_line_width();
        che = ch & 0x00FF;
        if(((che >= '0' && che <= '9') ||
                (che >= 'A' && che <= 'Z') ||
                (che >= 'a' && che <= 'z') ||
                ch == KE_BKSPACE) &&
                (active_mode().flags() & Plugin::UseCodeGuide) == Plugin::UseCodeGuide) {
            nfp = codeguider().get_go_address(ch);
            goto GO;
        }
        switch(ch) {
        case KE_CTL_F(1):
            if(active_mode().action_F1()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(2):
            if(active_mode().action_F2()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(3):
            if(active_mode().action_F3()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(4):
            if(active_mode().action_F4()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(5):
            if(active_mode().action_F5()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(6):
            if(active_mode().action_F6()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(7):
            if(active_mode().action_F7()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(8):
            if(active_mode().action_F8()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(9):
            if(active_mode().action_F9()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_CTL_F(10):
            if(active_mode().action_F10()) {
                ch = KE_SUPERKEY;
                drawPrompt();
            }
            break;
        case KE_ALT_F(1):
            nfp=bin_format().action_F1();
            break;
        case KE_ALT_F(2):
            nfp=bin_format().action_F2();
            break;
        case KE_ALT_F(3):
            nfp=bin_format().action_F3();
            break;
        case KE_ALT_F(4):
            nfp=bin_format().action_F4();
            break;
        case KE_ALT_F(5):
            nfp=bin_format().action_F5();
            break;
        case KE_ALT_F(6):
            nfp=bin_format().action_F6();
            break;
        case KE_ALT_F(7):
            nfp=bin_format().action_F7();
            break;
        case KE_ALT_F(8):
            nfp=bin_format().action_F8();
            break;
        case KE_ALT_F(9):
            nfp=bin_format().action_F9();
            break;
        case KE_ALT_F(10):
            nfp=bin_format().action_F10();
            break;
        case KE_SUPERKEY:
            goto DRAW;
        case KE_F(1) :
            About();
            continue;
        default :
            continue;
        case KE_SHIFT_F(1):
            active_mode().help();
            break;
        case KE_F(10):
        case KE_ESCAPE :
            return;
        case KE_ENTER:
            quick_select_mode();
            drawPrompt();
            ch = KE_SUPERKEY;
            break;
        case KE_F(2):
            if(select_mode()) ch = KE_SUPERKEY;
            break;
        case KE_F(3):
            if(new_source()) {
                ch = KE_SUPERKEY;
                s.reset();
                PaintTitle();
            }
            break;
        case KE_F(4):
            __filesize_t sfp;
            sfp = tell();
            active_mode().misckey_action();
            ch = KE_SUPERKEY;
            PaintTitle();
            drawPrompt();
            bm_file().seek(sfp,binary_stream::Seek_Set);
            break;
        case KE_F(5):
        {
            static __filesize_t shift = 0;
            static unsigned long flags = GJDLG_FILE_TOP;
            if(GetJumpDlg(&shift,&flags)) {
                switch(flags&0xFF) {
                default:
                case GJDLG_PERCENTS:
                    shift=shift>100?100:shift;
                    nfp = flength()*shift/100;
                    break;
                case GJDLG_FILE_TOP:
                    nfp = shift;
                    break;
                case GJDLG_RELATIVE:
                    nfp += (long)shift;
                    break;
                case GJDLG_REL_EOF:
                    nfp = flength()+(long)shift;
                    break;
                case GJDLG_VIRTUAL:
                    __filesize_t temp_fp;
                    nfp = shift;
                    temp_fp = bin_format().va2pa(shift);
                    if(temp_fp==Plugin::Bad_Address) ErrMessageBox(NOT_ENTRY,"");
                    else nfp = temp_fp;
                    break;
                }
                if((active_mode().flags() & Plugin::UseCodeGuide) == Plugin::UseCodeGuide)
                    codeguider().add_back_address();
                ch = KE_SUPERKEY;
            }
        }
        break;
        case KE_SHIFT_F(5): {
            WhereAMI wami(beye_context());
            nfp = wami.run(nfp);
        }
        break;
        case KE_F(6):
            bm_file().reread();
            s.reset();
            ch = KE_SUPERKEY;
            PaintTitle();
            break;
        case KE_SHIFT_F(6):
            select_sysinfo();
            break;
        case KE_F(7):
            nfp = s.run(false);
            ch = KE_JUSTFIND;
            break;
        case KE_SHIFT_F(7):
            nfp = s.run(true);
            ch = KE_JUSTFIND;
            break;
        case KE_F(8):
            nfp = bin_format().show_header();
            break;
        case KE_SHIFT_F(8):
            select_tool();
            break;
        case KE_F(9): {
            class Setup* setup = new class Setup(*this);
            setup->run();
            delete setup;
        }
        break;
        case KE_SHIFT_F(10):
            if(FileUtils()) {
                s.reset();
                ch = KE_SUPERKEY;
                PaintTitle();
            }
            break;
        case KE_HOME:
            rc.textshift = 0;
            break;
        case KE_END:
            rc.textshift = active_mode().get_max_line_length() - tconsole().vio_width()/2;
            break;
        case KE_UPARROW:
            nfp = cfp - active_mode().prev_line_width();
            break;
        case KE_DOWNARROW:
            nfp = cfp + active_mode().curr_line_width();
            break;
        case KE_RIGHTARROW:
            if((active_mode().flags() & Plugin::Text) == Plugin::Text)
                rc.textshift+=active_mode().get_symbol_size();
            else nfp = cfp + active_mode().get_symbol_size();
            break;
        case KE_LEFTARROW:
            if((active_mode().flags() & Plugin::Text) == Plugin::Text)
                rc.textshift-=active_mode().get_symbol_size();
            else nfp = cfp - active_mode().get_symbol_size();
            if(rc.textshift < 0) rc.textshift = 0;
            break;
        case KE_CTL_RIGHTARROW:
            if((active_mode().flags() & Plugin::Text) == Plugin::Text)
                rc.textshift+=8*active_mode().get_symbol_size();
            else nfp = cfp + 8*active_mode().get_symbol_size();
            break;
        case KE_CTL_LEFTARROW:
            if((active_mode().flags() & Plugin::Text) == Plugin::Text)
                rc.textshift-=8*active_mode().get_symbol_size();
            else nfp = cfp - 8*active_mode().get_symbol_size();
            if(rc.textshift < 0) rc.textshift = 0;
            break;
        case KE_PGUP:
            nfp = cfp - active_mode().prev_page_size();
            break;
        case KE_PGDN:
            nfp = cfp + active_mode().curr_page_size();
            break;
        case KE_CTL_PGUP:
            nfp = 0;
            break;
        case KE_CTL_PGDN:
            nfp = flen;
            break;
        case KE_CTL_(O): /** User screen */
        {
            unsigned evt;
            main_wnd().hide();
            title_wnd().hide();
            do {
                evt = GetEvent(drawEmptyPrompt,NULL,NULL);
            }
            while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_CTL_(O)));
            main_wnd().show();
            title_wnd().show();
        }
        continue;
        }
GO:
        if(cfp != nfp && nfp != Plugin::Bad_Address) {
            unsigned long twidth = ( active_mode().flags() & Plugin::Text ) == Plugin::Text ?
                                   active_mode().get_symbol_size() :
                                   ( active_mode().flags() & Plugin::Disasm ) == Plugin::Disasm ?
                                   1 : lwidth;
            __filesize_t p = flen - twidth;
            if((__fileoff_t)nfp < 0) nfp = 0;
            if(nfp > 0) if(nfp > p) nfp = p;
        }
        bm_file().seek(nfp,binary_stream::Seek_Set);
DRAW:
        if((active_mode().flags() & Plugin::Text) != Plugin::Text) savep = tell();
        rc = active_mode().paint(ch,rc.textshift);
        if((active_mode().flags() & Plugin::Text) != Plugin::Text) bm_file().seek(savep,binary_stream::Seek_Set);
        draw_title(rc.lastbyte);
    }
}
Esempio n. 4
0
	virtual void PaintBarH(Option_t * option)
	{
		/**
		Copied from https://root.cern.ch/root/html/src/THistPainter.cxx.html#s5vHLC
		Added option ("RTOL") to draw histograms from right to left
		*/
		Int_t nch = strlen(option)+1;
		char choption[nch];
		strlcpy(choption,option,nch);
		for (Int_t i=0;i<nch;i++) choption[i] = toupper(choption[i]);
		
		bool inverseHorizontally = strstr(choption, "RTOL");
		if (! inverseHorizontally) {
			THistPainter::PaintBarH(option);
		}
		else {
			/* Begin_html
			<a href="#HP10">Draw a bar char in a rotated pad (X vertical, Y horizontal).</a>
			End_html */

			gPad->SetVertical(kFALSE);

			PaintInitH();

			TAxis *xaxis = fXaxis;
			TAxis *yaxis = fYaxis;
			if (!strcmp(xaxis->GetName(),"xaxis")) {
				fXaxis = yaxis;
				fYaxis = xaxis;
			}

			PaintFrame();

			Int_t bar = 0;//Hoption.Bar - 20;
			Double_t xmin,xmax,ymin,ymax,umin,umax,w;
			Double_t offset = fH->GetBarOffset();
			Double_t width  = fH->GetBarWidth();
			TBox box;
			Int_t hcolor = fH->GetFillColor();
			if (hcolor == gPad->GetFrameFillColor()) ++hcolor;
			Int_t hstyle = fH->GetFillStyle();
			box.SetFillColor(hcolor);
			box.SetFillStyle(hstyle);
			for (Int_t bin=fYaxis->GetFirst();bin<=fYaxis->GetLast();bin++) {
				ymin = gPad->YtoPad(fYaxis->GetBinLowEdge(bin));
				ymax = gPad->YtoPad(fYaxis->GetBinUpEdge(bin));
				xmin = (inverseHorizontally ? -gPad->XtoPad(fH->GetBinContent(bin)) : gPad->GetUxmin());
				xmax = (inverseHorizontally ? gPad->GetUxmax() : gPad->XtoPad(fH->GetBinContent(bin)));
				if (xmax < gPad->GetUxmin()) continue;
				if (xmax > gPad->GetUxmax()) xmax = gPad->GetUxmax();
				if (xmin < gPad->GetUxmin()) xmin = gPad->GetUxmin();
				if (gStyle->GetHistMinimumZero() && xmin < 0)
					xmin=TMath::Min(0.,gPad->GetUxmax());
				w = (ymax-ymin)*width;
				ymin += offset*(ymax-ymin);
				ymax = ymin + w;
				if (bar < 1) {
					box.PaintBox(xmin,ymin,xmax,ymax);
				} else {
					umin = ymin + bar*(ymax-ymin)/10.;
					umax = ymax - bar*(ymax-ymin)/10.;
					box.SetFillColor(TColor::GetColorDark(hcolor)); //dark
					box.PaintBox(xmin,ymin,xmax,umin);
					box.SetFillColor(hcolor);
					box.PaintBox(xmin,umin,xmax,umax);
					box.SetFillColor(TColor::GetColorBright(hcolor)); //bright
					box.PaintBox(xmin,umax,xmax,ymax);
				}
			}

			PaintTitle();
			// Draw box with histogram statistics and/or fit parameters
			if (false) {
			//if (Hoption.Same != 1 && !fH->TestBit(TH1::kNoStats)) {  // bit set via TH1::SetStats
				TIter next(fFunctions);
				TObject *obj = 0;
				while ((obj = next())) {
					if (obj->InheritsFrom(TF1::Class())) break;
					obj = 0;
				}
				PaintStat(gStyle->GetOptStat(),(TF1*)obj);
			}

			PaintAxis(kFALSE);
			fXaxis = xaxis;
			fYaxis = yaxis;
		}
	}