Esempio n. 1
0
//------------------------------------------------------------------------
CMouseEventResult CCheckBox::onMouseCancel ()
{
	hilight = false;
	value = previousValue;
	if (isDirty ())
		invalid ();
	endEdit ();
	return kMouseEventHandled;
}
Esempio n. 2
0
//-----------------------------------------------------------------------------
void CGradientView::setFrameWidth (CCoord width)
{
	if (width != frameWidth)
	{
		frameWidth = width;
		path = 0;
		invalid ();
	}
}
Esempio n. 3
0
//-----------------------------------------------------------------------------
void CGradientView::setRoundRectRadius (CCoord radius)
{
	if (radius != roundRectRadius)
	{
		roundRectRadius = radius;
		path = 0;
		invalid ();
	}
}
Esempio n. 4
0
//-----------------------------------------------------------------------------
void CSegmentButton::setStyle (Style newStyle)
{
	if (style != newStyle)
	{
		style = newStyle;
		updateSegmentSizes ();
		invalid ();
	}
}
Esempio n. 5
0
//-----------------------------------------------------------------------------------
CMouseEventResult MyKnob::onMouseEntered (CPoint &where, const CButtonState& buttons)
{
    //-- the mouse entered our knob, so we change the handle to the highlighted one
    setHandleBitmap (highlightHandleBitmap);

    //-- we must get redrawn
    invalid ();

    return CKnob::onMouseEntered (where, buttons);
}
Esempio n. 6
0
bool kernel_sec_set_debug_level(int level)
{
	if (!(level == KERNEL_SEC_DEBUG_LEVEL_LOW 
			|| level == KERNEL_SEC_DEBUG_LEVEL_MID 
			|| level == KERNEL_SEC_DEBUG_LEVEL_HIGH)) {
		printk(KERN_NOTICE "(kernel_sec_set_debug_level) The debug value is \
				invalid(0x%x)!! Set default level(LOW)\n", level);
		debug_level = KERNEL_SEC_DEBUG_LEVEL_LOW;
		return 0;
	}
Esempio n. 7
0
// check for invalid variance values
static inline bool invalid_var(float data)
{
    if (invalid(data)) {
        return true;
    }
    if (data < 1e-15f) { // var should not be close to zero. And not negative either.
        return true;
    }
    return false;
}
Esempio n. 8
0
//-----------------------------------------------------------------------------------
CMouseEventResult MyKnob::onMouseExited (CPoint &where, const long& buttons)
{
	//-- the mouse exited our knob, so change the handle to the default one
	setHandleBitmap (handleBitmap);

	//-- we must get redrawn
	invalid ();

	return CKnob::onMouseExited (where, buttons);
}
Esempio n. 9
0
//------------------------------------------------------------------------
void CCheckBox::setStyle (int32_t newStyle)
{
	if (style != newStyle)
	{
		style = newStyle;
		if (style & kAutoSizeToFit)
			sizeToFit ();
		invalid ();
	}
}
Esempio n. 10
0
CMessageResult CWaveDisplay::notify (CBaseObject* sender, IdStringPtr message)
{
    if (message == CVSTGUITimer::kMsgTimer)
    {
        invalid();

        return kMessageNotified;
    }
    return kMessageUnknown;
}
Esempio n. 11
0
AxisEventPtr
AxisEvent::from_string(const std::string& str)
{
  AxisEventPtr ev;

  std::string::size_type p = str.find(':');
  const std::string& token = str.substr(0, p);
  std::string rest;

  if (p != std::string::npos)
    rest = str.substr(p+1);

  if (token == "abs")
  {
    ev.reset(new AxisEvent(AbsAxisEventHandler::from_string(rest)));
  }
  else if (token == "rel")
  {
    ev.reset(new AxisEvent(RelAxisEventHandler::from_string(rest)));
  }
  else if (token == "rel-repeat")
  {
    ev.reset(new AxisEvent(RelRepeatAxisEventHandler::from_string(rest)));
  }
  else if (token == "key")
  {
    ev.reset(new AxisEvent(KeyAxisEventHandler::from_string(rest)));
  }
  else
  { // try to guess a type
    switch (get_event_type(str))
    {
      case EV_ABS:
        ev.reset(new AxisEvent(AbsAxisEventHandler::from_string(str)));
        break;

      case EV_REL:
        ev.reset(new AxisEvent(RelAxisEventHandler::from_string(str)));
        break;

      case EV_KEY:
        ev.reset(new AxisEvent(KeyAxisEventHandler::from_string(str)));
        break;

      case -1: // void/none
        ev = invalid();
        break;

      default:
        assert(!"should never be reached");
    }
  }

  return ev;
}
Esempio n. 12
0
void ExpressionButton::on_clicked(){
	Gtk::Dialog *tf_dialog = new Gtk::Dialog("True or False");
	tf_dialog->add_button("True", TRUE_RESPONSE);
	tf_dialog->add_button("False", FALSE_RESPONSE);
	int response = tf_dialog->run();
	if(!this->exp->isUnassigned()){
		Gtk::MessageDialog invalid("Expression already has a value");
		invalid.run();
		invalid.hide();
		tf_dialog->hide();
		delete tf_dialog;
		Gtk::Button::on_clicked();
		return;
	}
	if(response == TRUE_RESPONSE){
		if(m_model->can_assign_TVal(num, pos, true)){
			this->exp->setTruthValue(true);
			Gtk::Label* true_label = Gtk::manage(new Gtk::Label("T"));
			true_label->show();
			m_parent->attach_next_to(*true_label, *this, Gtk::POS_BOTTOM ,1,1);
		}else{
			Gtk::MessageDialog invalid("Not a valid assignment");
			invalid.run();
			invalid.hide();
		}
	}else if(response == FALSE_RESPONSE){
		if(m_model->can_assign_TVal(num, pos, false)){
			this->exp->setTruthValue(false);
			Gtk::Label* true_label = Gtk::manage(new Gtk::Label("F"));
			true_label->show();
			m_parent->attach_next_to(*true_label, *this, Gtk::POS_BOTTOM ,1,1);
		}else{
			Gtk::MessageDialog invalid("Not a valid assignment");
			invalid.run();
			invalid.hide();
		}
		
	}
	tf_dialog->hide();
	delete tf_dialog;
	Gtk::Button::on_clicked();
}
Esempio n. 13
0
//--------------------------------------------------------------------------------
bool CRowColumnView::sizeToFit ()
{
	if (children.size () > 0)
	{
		CRect viewSize = getViewSize ();
		CPoint maxSize;
		ViewIterator it (this);
		if (style == kRowStyle)
		{
			while (*it)
			{
				CRect size = (*it)->getViewSize ();
				if (size.getWidth () > maxSize.x)
					maxSize.x = size.getWidth ();
				maxSize.y += size.getHeight () + spacing;
				it++;
			}
		}
		else
		{
			while (*it)
			{
				CRect size = (*it)->getViewSize ();
				maxSize.x += size.getWidth () + spacing;
				if (size.bottom > maxSize.y)
					maxSize.y = size.getHeight ();
				it++;
			}
		}
		viewSize.setWidth (maxSize.x + margin.left + margin.right);
		viewSize.setHeight (maxSize.y + margin.top + margin.bottom);
		if (viewSize != getViewSize ())
		{
			invalid ();
			CViewContainer::setViewSize (viewSize);
			CViewContainer::setMouseableArea (viewSize);
			invalid ();
		}
		return true;
	}
	return false;
}
Esempio n. 14
0
int main(int argc, char *argv[]) {
    int noteval[] = {0, 2, -9, -7, -5, -4, -2};
    int note = 69, c;
    double freq;
    char notename[3];

    if (argc >= 2 && strlen(argv[1]) >= 3) {
        notename[0] = argv[1][0];
        notename[1] = argv[1][1];
        notename[2] = argv[1][2];
    } else {
        notename[0] = getchar();
        notename[1] = getchar();
        notename[2] = getchar();
    }

    c = toupper(notename[0]) - 'A';
    if(c<0 || c>6) invalid();

    note += noteval[c];

    switch(notename[1]) {
        case '-': /* Natural note: do nothing */
            break;
        case '#': /* Sharp: increase note by 1 */
            note++;
            break;
        case 'b': /* Flat: decrease note by 1 */
            note--;
            break;
        default: /* Something weird */
            invalid();
    }

    c = notename[2] - '0';
    if(c<0 || c>9) invalid();
    note += (c - 4) * 12;

    freq = 440 * pow(2.0, (note - 69) / 12.0);
    printf("%f\n",freq);
    return EXIT_SUCCESS;
}
Esempio n. 15
0
int main(int argc, char * argv[]) {
	peopleHead = NULL;
	allMahHashes_employees = ht_create(65536);
	allMahHashes_guests = ht_create(65536);
	int32_t fileSize = 0;
	FILE* file = NULL;
	size_t bytes = 0;
	ssize_t read = 0;
	char * line = NULL;
	char interString[MAX * 4];

	//get Logreader arguements
	logread_args args = opt_parser(argc, argv, 1);
	//Verify integrity and hopefully the syntax should be right

	fileSize = fsize(args.logName);
	if (fileSize > 15) {
		unsigned int salt[] = { 12345, 54321 };
		FILE * encrypted_file = fopen(args.logName, "r");
		FILE * decrypted = fopen("tempblahman", "w+");
		do_crypt(encrypted_file, decrypted, DECRYPT, args.token,
				strlen(args.token), (unsigned char *) salt);
		rename("tempblahman", args.logName);
	} else {
		invalid();
	}

	file = fopen(args.logName, "r");
	//Line by line apply the options
	while ((read = getline(&line, &bytes, file)) != -1 && fileSize > 10) {

		int len = strlen(line);
		fileSize = fileSize - len;
		// RERUN COMMANDS CAUZE LOGIC!
		sprintf(interString, "./logappend %s", line);
		int tempc;
		char ** tempv = argv_split(interString, &tempc);
		logappend_args temp = opt_parser_log(tempc, tempv);
		buildDataStructs(&temp);
		bzero(interString, MAX * 4);
		argv_free(tempv);
		// FINISH LOGICZ
	}
	doBadThings(&args);

	unsigned int salt[] = { 12345, 54321 };
	FILE * decrypted_file = fopen(args.logName, "r");
	FILE * encrypted = fopen("tempblahman", "w+");
	do_crypt(decrypted_file, encrypted, ENCRYPT, args.token, strlen(args.token),
			(unsigned char *) salt);
	rename("tempblahman", args.logName);

	return 0;
}
Esempio n. 16
0
void IRI::SetCredentials(const string& user, const string& pass)
{
    url_canon::Replacements<char> rep;
    url_parse::Component invalid(0, -1);
    rep.SetUsername(user.c_str(), ComponentForString(user));
    rep.SetPassword(pass.c_str(), ComponentForString(pass));
    _url->ReplaceComponentsInline(rep);
    
    // can't keep the IRI up to date
    _pureIRI.clear();
}
Esempio n. 17
0
//------------------------------------------------------------------------
CMouseEventResult CKickButton::onMouseUp (CPoint& where, const CButtonState& buttons)
{
	if (value)
		valueChanged ();
	value = getMin ();
	valueChanged ();
	if (isDirty ())
		invalid ();
	endEdit ();
	return kMouseEventHandled;
}
Esempio n. 18
0
//-----------------------------------------------------------------------------------
CMouseEventResult MyKnob::onMouseDown (CPoint &where, const long& buttons)
{
	//-- we are being tracked so change the handle bitmap to the highlighted one
	setHandleBitmap (highlightHandleBitmap);

	//-- make sure we will get redrawn
	invalid ();

	//-- all other mouse handling stuff is done in the parent class
	return CKnob::onMouseDown (where, buttons);
}
Esempio n. 19
0
static u32int
doshift(u32int instr)
{
	ulong amount, val;
	
	if((instr & (1<<4)) && (instr & (1<<7)))
		invalid(instr);
	
	if(instr & (1<<4))
		amount = P->R[(instr >> 8) & 15];
	else
Esempio n. 20
0
//------------------------------------------------------------------------
void CTextButton::setFont (CFontRef newFont)
{
	if (newFont == 0)
		return;
	if (font)
		font->forget ();
	font = newFont;
	if (font)
		font->remember ();
	invalid ();
}
Esempio n. 21
0
// ============================================================================
StatusCode Tuples::TupleObj::column ( const std::string&       name  ,
                                      const unsigned long long value ,
                                      const unsigned long long minv  ,
                                      const unsigned long long maxv  )
{
  if ( invalid() ) { return InvalidTuple  ; }
  ULongLong* item = ulonglongs ( name , minv , maxv ) ;
  if ( !item )     { return InvalidColumn ; }
  *item = value ;
  return StatusCode::SUCCESS ;
}
Esempio n. 22
0
void init(Arguments args)
{
    char *s;
    invalid(args.alphabet, args.cle);
    if(args.skip == 1)
    {
        s = skip(args.message, args.alphabet);
        strcpy(args.message, s);
    }
    args.cle = repeatkey(args.cle, strlen(args.message));
}
Esempio n. 23
0
// ============================================================================
StatusCode Tuples::TupleObj::column ( const std::string&   name  ,
                                      const unsigned int   value ,
                                      const unsigned int   minv  ,
                                      const unsigned int   maxv  )
{
  if ( invalid() ) { return InvalidTuple  ; }
  UInt* item = uints ( name , minv , maxv ) ;
  if ( !item )     { return InvalidColumn ; }
  *item = value ;
  return StatusCode::SUCCESS ;
}
Esempio n. 24
0
// ============================================================================
StatusCode Tuples::TupleObj::column ( const std::string&  name  ,
                                      const short         value ,
                                      const short         minv  ,
                                      const short         maxv  )
{
  if ( invalid() ) { return InvalidTuple  ; }
  Short* item = shorts ( name , minv , maxv ) ;
  if ( !item )     { return InvalidColumn ; }
  *item = value ;
  return StatusCode::SUCCESS ;
}
Esempio n. 25
0
// ============================================================================
StatusCode Tuples::TupleObj::column ( const std::string& name  ,
                                      const char         value ,
                                      const char         minv  ,
                                      const char         maxv  )
{
  if ( invalid() ) { return InvalidTuple  ; }
  Char* item = chars ( name , minv , maxv ) ;
  if ( !item )     { return InvalidColumn ; }
  *item = value ;
  return StatusCode::SUCCESS ;
}
Esempio n. 26
0
//------------------------------------------------------------------------
int32_t CKickButton::onKeyUp (VstKeyCode& keyCode)
{
	if (keyCode.modifier == 0 && keyCode.virt == VKEY_RETURN)
	{
		value = getMin ();
		invalid ();
		valueChanged ();
		endEdit ();
		return 1;
	}
	return -1;
}
Esempio n. 27
0
//------------------------------------------------------------------------
CMouseEventResult CTextKickButton::onMouseUp (CPoint& where, const long& buttons)
{
	if (value && listener)
		listener->valueChanged (this);
	value = 0.0f;
	if (listener)
		listener->valueChanged (this);
	if (isDirty ())
		invalid ();
	endEdit ();
	return kMouseEventHandled;
}
Esempio n. 28
0
main(int argc, char *argv[])
{ 
    int pid, cmd, i;
    char name[64];
    ucolor = 0;
    clearScreen(UMODE);
    printf("enter main() : argc = %d\n", argc);
    for (i=0; i<argc; i++)
        printf("argv[%d] = %s\n", i, argv[i]);

    while(1){
        pid = getpid();
        color = ucolor ? ucolor:0x000B + (pid % 5);// avoid black on black baground
        cmd?resetCursor(UMODE):1;
        printf("----------------------------------------------\n");
        printf("I am proc %din U mode: segment=%x\n", pid, (pid+1)*0x1000);
        show_menu();
        printf("Command ? ");
        getCurPos(UMODE);
        printf("                                                                      \n");
        setCurPos(ux_col,uy_row,UMODE);
        gets(name);
        clearScreenRegion(K_X_PRINT_OFFSET,80,U_Y_PRINT_OFFSET-1,24,UMODE);
        if (name[0]==0) 
            continue;

        cmd = find_cmd(name);
        
        getCurPos(UMODE);
        setCurPos(K_X_PRINT_OFFSET,U_Y_PRINT_OFFSET,UMODE);
        switch(cmd){
            case 0 : do_getpid();   break;
            case 1 : ps();          break;
            case 2 : chname();      break;
            case 3 : kmode();       break;
            case 4 : kswitch();     break;
            case 5 : wait();        break;
            case 6 : exit();        break;
            case 7 : fork();        break;
            case 8 : exec();        break;
            case 9 : ucolor = chcolor();     break;

            case 10: pipe();        break;
            case 11: pfd();         break;
            case 12: read_pipe();   break;
            case 13: write_pipe();  break;
            case 14: close_pipe();  break;
            
            default: invalid(name); break;
        }
        setCurPos(ux_col,uy_row,UMODE);
    }
}
Esempio n. 29
0
//-----------------------------------------------------------------------------------
CMouseEventResult MyKnob::onMouseUp (CPoint &where, const long& buttons)
{
	//-- if the mouse is not over the knob
	if (!where.isInside (size))
	{
		//-- we change the handle to the default one
		setHandleBitmap (handleBitmap);

		//-- and again make sure we will get redrawn
		invalid ();
	}
	return CKnob::onMouseUp (where, buttons);
}
Esempio n. 30
0
//------------------------------------------------------------------------
int32_t CMovieButton::onKeyDown (VstKeyCode& keyCode)
{
	if (keyCode.virt == VKEY_RETURN && keyCode.modifier == 0)
	{
		value = (value == getMax ()) ? getMin () : getMax ();
		invalid ();
		beginEdit ();
		valueChanged ();
		endEdit ();
		return 1;
	}
	return -1;
}