Exemple #1
0
bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
{
    bool handled = false;
    // we have a native implementation for Win32 and so don't need this one
#ifndef __WIN32__
    wxChar ch = 0;
    int keycode = event.GetKeyCode();
    
    long from, to;
    GetSelection(&from,&to);
    long insert = GetInsertionPoint();
    long last = GetLastPosition();
    
    // catch arrow left and right 
    
    switch ( keycode )
    {
        case WXK_LEFT:
            if ( event.ShiftDown() )
                SetSelection( (from > 0 ? from - 1 : 0) , to );
            else
            {
                if ( from != to )
                    insert = from;
                else if ( insert > 0 )
                    insert -= 1;
                SetInsertionPoint( insert );
            }
            handled = true;
            break;
        case WXK_RIGHT:
            if ( event.ShiftDown() )
                SetSelection( from, (to < last ? to + 1 : last) );
            else
            {
                if ( from != to )
                    insert = to;
                else if ( insert < last )
                    insert += 1;
                SetInsertionPoint( insert );
            }
            handled = true;
            break;
        case WXK_NUMPAD0:
        case WXK_NUMPAD1:
        case WXK_NUMPAD2:
        case WXK_NUMPAD3:
        case WXK_NUMPAD4:
        case WXK_NUMPAD5:
        case WXK_NUMPAD6:
        case WXK_NUMPAD7:
        case WXK_NUMPAD8:
        case WXK_NUMPAD9:
            ch = (wxChar)(wxT('0') + keycode - WXK_NUMPAD0);
            break;

        case WXK_MULTIPLY:
        case WXK_NUMPAD_MULTIPLY:
            ch = wxT('*');
            break;

        case WXK_ADD:
        case WXK_NUMPAD_ADD:
            ch = wxT('+');
            break;

        case WXK_SUBTRACT:
        case WXK_NUMPAD_SUBTRACT:
            ch = wxT('-');
            break;

        case WXK_DECIMAL:
        case WXK_NUMPAD_DECIMAL:
            ch = wxT('.');
            break;

        case WXK_DIVIDE:
        case WXK_NUMPAD_DIVIDE:
            ch = wxT('/');
            break;

        case WXK_DELETE:
        case WXK_NUMPAD_DELETE:
            // delete the character at cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos < GetLastPosition() )
                    Remove(pos, pos + 1);
                handled = true;
            }
            break;

        case WXK_BACK:
            // delete the character before the cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos > 0 )
                    Remove(pos - 1, pos);
                handled = true;
            }
            break;

        default:
#if wxUSE_UNICODE
            if ( event.GetUnicodeKey() )
            {
                ch = event.GetUnicodeKey();
            }
            else
#endif
            if ( keycode < 256 && keycode >= 0 && wxIsprint(keycode) )
            {
                // FIXME this is not going to work for non letters...
                if ( !event.ShiftDown() )
                {
                    keycode = wxTolower(keycode);
                }

                ch = (wxChar)keycode;
            }
            else
            {
                ch = wxT('\0');
            }
    }

    if ( ch )
    {
        WriteText(ch);

        handled = true;
    }
#else // __WIN32__
    wxUnusedVar(event);
#endif // !__WIN32__/__WIN32__

    return handled;
}
Exemple #2
0
PTASK_RECORD CTaskHeap::RemoveTopmost(SCHCMP *pfCompare)
{
    return Remove(0, pfCompare);
}
Exemple #3
0
  Resource::~Resource()
	{
    Remove(mName.c_str());
	}
Exemple #4
0
bool CSafebox::MoveItem(BYTE bCell, BYTE bDestCell, BYTE count)
{
	LPITEM item;

	int max_position = 5 * m_iSize;

	if (bCell >= max_position || bDestCell >= max_position)
		return false;

	if (!(item = GetItem(bCell)))
		return false;

	if (item->IsExchanging())
		return false;

	if (item->GetCount() < count)
		return false;

	{
		LPITEM item2;

		if ((item2 = GetItem(bDestCell)) && item != item2 && item2->IsStackable() &&
				!IS_SET(item2->GetAntiFlag(), ITEM_ANTIFLAG_STACK) &&
				item2->GetVnum() == item->GetVnum()) // 합칠 수 있는 아이템의 경우
		{
			for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
				if (item2->GetSocket(i) != item->GetSocket(i))
					return false;

			if (count == 0)
				count = item->GetCount();

			count = MIN(200 - item2->GetCount(), count);

			if (item->GetCount() >= count)
				Remove(bCell);

			item->SetCount(item->GetCount() - count);
			item2->SetCount(item2->GetCount() + count);

			sys_log(1, "SAFEBOX: STACK %s %d -> %d %s count %d", m_pkChrOwner->GetName(), bCell, bDestCell, item2->GetName(), item2->GetCount());
			return true;
		}

		if (!IsEmpty(bDestCell, item->GetSize()))
			return false;

		m_pkGrid->Get(bCell, 1, item->GetSize());

		if (!m_pkGrid->Put(bDestCell, 1, item->GetSize()))
		{
			m_pkGrid->Put(bCell, 1, item->GetSize());
			return false;
		}
		else
		{
			m_pkGrid->Get(bDestCell, 1, item->GetSize());
			m_pkGrid->Put(bCell, 1, item->GetSize());
		}

		sys_log(1, "SAFEBOX: MOVE %s %d -> %d %s count %d", m_pkChrOwner->GetName(), bCell, bDestCell, item->GetName(), item->GetCount());

		Remove(bCell);
		Add(bDestCell, item);
	}

	return true;
}
// Sort selected entries to the top of the list
void buffer_sort_selected(DirBuffer *buffer)
{
	struct MinList temp;
	DirEntry *entry,*first_file=0,*first_pos=0;

	// Lock buffer
	buffer_lock(buffer,TRUE);

	// Initialise temporary list
	NewList((struct List *)&temp);

	// Go through entries
	for (entry=(DirEntry *)buffer->entry_list.mlh_Head;
		entry->de_Node.dn_Succ;)
	{
		DirEntry *next=(DirEntry *)entry->de_Node.dn_Succ;

		// File?
		if (ENTRYTYPE(entry->de_Node.dn_Type)==ENTRY_FILE)
		{
			// Remove and add to temporary if selected
			if (entry->de_Flags&ENTF_SELECTED)
			{
				// Remember first position
				if (!first_pos) first_pos=(DirEntry *)entry->de_Node.dn_Pred;

				// Remove and re-add
				Remove((struct Node *)entry);
				AddTail((struct List *)&temp,(struct Node *)entry);
			}

			// Remember if the first file
			else
			if (!first_file) first_file=entry;
		}

		// Get next
		entry=next;
	}

	// Something in the temporary list?
	if (!(IsListEmpty((struct List *)&temp)))
	{
		// If we have a first file, get its predecessor
		if (first_file) first_pos=(DirEntry *)first_file->de_Node.dn_Pred;

		// Go through temporary list, add after first position
		for (entry=(DirEntry *)temp.mlh_Head;
			entry->de_Node.dn_Succ;)
		{
			DirEntry *next=(DirEntry *)entry->de_Node.dn_Succ;

			// Remove and add after last one
			Remove((struct Node *)entry);
			Insert((struct List *)&buffer->entry_list,(struct Node *)entry,(struct Node *)first_pos);

			// Bump next position
			first_pos=(DirEntry *)entry;

			// Get next
			entry=next;
		}
	}

	// Unlock buffer
	buffer_unlock(buffer);
}
void dgConvexHull4d::DeleteFace (dgListNode* const node) 
{
	Remove (node);
}
Exemple #7
0
// Remove all images
bool wxImageList::RemoveAll()
{
    // don't use ImageList_RemoveAll() because mingw32 headers don't have it
    return Remove(-1);
}
FrameModifier::~FrameModifier()
{
	Remove();
}
Exemple #9
0
bool wxTextCtrlBase::EmulateKeyPress(const wxKeyEvent& event)
{
    wxChar ch = 0;
    int keycode = event.GetKeyCode();
    switch ( keycode )
    {
        case WXK_NUMPAD0:
        case WXK_NUMPAD1:
        case WXK_NUMPAD2:
        case WXK_NUMPAD3:
        case WXK_NUMPAD4:
        case WXK_NUMPAD5:
        case WXK_NUMPAD6:
        case WXK_NUMPAD7:
        case WXK_NUMPAD8:
        case WXK_NUMPAD9:
            ch = (wxChar)(_T('0') + keycode - WXK_NUMPAD0);
            break;

        case WXK_MULTIPLY:
        case WXK_NUMPAD_MULTIPLY:
            ch = _T('*');
            break;

        case WXK_ADD:
        case WXK_NUMPAD_ADD:
            ch = _T('+');
            break;

        case WXK_SUBTRACT:
        case WXK_NUMPAD_SUBTRACT:
            ch = _T('-');
            break;

        case WXK_DECIMAL:
        case WXK_NUMPAD_DECIMAL:
            ch = _T('.');
            break;

        case WXK_DIVIDE:
        case WXK_NUMPAD_DIVIDE:
            ch = _T('/');
            break;

        case WXK_DELETE:
        case WXK_NUMPAD_DELETE:
            // delete the character at cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos < GetLastPosition() )
                    Remove(pos, pos + 1);
            }
            break;

        case WXK_BACK:
            // delete the character before the cursor
            {
                const long pos = GetInsertionPoint();
                if ( pos > 0 )
                    Remove(pos - 1, pos);
            }
            break;

        default:
#if wxUSE_UNICODE
            if ( event.GetUnicodeKey() )
            {
                ch = event.GetUnicodeKey();
            }
            else
#endif
            if ( keycode < 256 && keycode >= 0 && wxIsprint(keycode) )
            {
                // FIXME this is not going to work for non letters...
                if ( !event.ShiftDown() )
                {
                    keycode = wxTolower(keycode);
                }

                ch = (wxChar)keycode;
            }
            else
            {
                ch = _T('\0');
            }
    }

    if ( ch )
    {
        WriteText(ch);

        return true;
    }

    return false;
}
static void 
FillReadBuffer ( struct AHIRequest *ioreq,
                 struct AHIDevUnit *iounit,
                 struct AHIBase *AHIBase )
{
  ULONG length,length2;
  APTR  oldaddress;
  BOOL  remove;

  if(iounit->ValidRecord) // Make sure we have a valid source buffer
  {
    oldaddress = ioreq->ahir_Std.io_Data;

    length = (ioreq->ahir_Std.io_Length - ioreq->ahir_Std.io_Actual)
             / AHI_SampleFrameSize(ioreq->ahir_Type);

    length2 = (iounit->RecordSize - ioreq->ahir_Std.io_Offset)
              / AHI_SampleFrameSize(AHIST_S16S);
    length2 = MultFixed(length2, (Fixed) ioreq->ahir_Frequency);

    if(length <= length2)
    {
      remove=TRUE;
    }
    else
    {
      length = length2;
      remove = FALSE;
    }

    switch (ioreq->ahir_Type)
    {
#if 0
      case AHIST_M8S:
        RecM8S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
      case AHIST_S8S:
        RecS8S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
      case AHIST_M16S:
        RecM16S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
      case AHIST_S16S:
        RecS16S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
      case AHIST_M32S:
        RecM32S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
      case AHIST_S32S:
        RecS32S(length,ioreq->ahir_Frequency,
            iounit->RecordBuffer,
            &ioreq->ahir_Std.io_Offset,
            &ioreq->ahir_Std.io_Data);
        break;
#endif
      default:
        ioreq->ahir_Std.io_Error = AHIE_BADSAMPLETYPE;
        remove = TRUE;
        break;
    }
    
    ioreq->ahir_Std.io_Actual += ((ULONG) ioreq->ahir_Std.io_Data - (ULONG) oldaddress);

    if(remove)
    {
      Remove((struct Node *) ioreq);
      TermIO(ioreq, AHIBase);
    }
    else
    {
      ioreq->ahir_Std.io_Offset = 0;
    }
  }
  else
  {
    ioreq->ahir_Std.io_Offset = 0;
  }
}
Exemple #11
0
 void Set(FileDescriptor fd, unsigned mask, FileEventHandler &handler) {
   if (mask != 0)
     Add(fd, mask, handler);
   else
     Remove(fd);
 }
ULONG
DevAbortIO( struct AHIRequest* ioreq,
            struct AHIBase*    AHIBase )
{
  ULONG rc = NULL;
  struct AHIDevUnit *iounit;
  
  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
  {
    KPrintF("AbortIO(0x%08lx)", ioreq);
  }

  iounit = (struct AHIDevUnit *) ioreq->ahir_Std.io_Unit;
  
  ObtainSemaphore(&iounit->ListLock);
  if(ioreq->ahir_Std.io_Message.mn_Node.ln_Type != NT_REPLYMSG)
  {
    switch(ioreq->ahir_Std.io_Command)
    {

      case CMD_READ:
        if(FindNode((struct List *) &iounit->ReadList, (struct Node *) ioreq))
        {
          Remove((struct Node *) ioreq);
          ioreq->ahir_Std.io_Error = IOERR_ABORTED;
          TermIO(ioreq,AHIBase);
        }
        break;

      case CMD_WRITE:
      case AHICMD_WRITTEN:
        if(FindNode((struct List *) &iounit->PlayingList, (struct Node *) ioreq)
        || FindNode((struct List *) &iounit->SilentList, (struct Node *) ioreq)
        || FindNode((struct List *) &iounit->WaitingList, (struct Node *) ioreq))
        {
          struct AHIRequest *nextreq;

          while(ioreq)
          {
            Remove((struct Node *) ioreq);

            if(ioreq->ahir_Extras && (GetExtras(ioreq)->Channel != NOCHANNEL))
            {
              iounit->Voices[GetExtras(ioreq)->Channel].PlayingRequest = NULL;
              iounit->Voices[GetExtras(ioreq)->Channel].QueuedRequest = NULL;
              iounit->Voices[GetExtras(ioreq)->Channel].NextRequest = NULL;
              iounit->Voices[GetExtras(ioreq)->Channel].NextOffset = MUTE;
              if(iounit->AudioCtrl)
              {
                AHI_SetSound(GetExtras(ioreq)->Channel,AHI_NOSOUND,0,0,
                    iounit->AudioCtrl,AHISF_IMM);
              }
            }

            ioreq->ahir_Std.io_Command = CMD_WRITE;
            ioreq->ahir_Std.io_Error   = IOERR_ABORTED;
            nextreq = ioreq->ahir_Link;
            TermIO(ioreq,AHIBase);
            ioreq = nextreq;
          }
        }

      default:
        rc = IOERR_NOCMD;
        break;
    }
  }
  ReleaseSemaphore(&iounit->ListLock);

  if(AHIBase->ahib_DebugLevel >= AHI_DEBUG_LOW)
  {
    KPrintF("=>%ld\n",rc);
  }

  return rc;
}
static void
NewWriter ( struct AHIRequest *ioreq,
            struct AHIDevUnit *iounit,
            struct AHIBase *AHIBase )
{
  int channel, sound;
  BOOL delay = FALSE;
  struct AHISampleInfo si;
  struct Library *AHIsubBase;

  AHIsubBase = ((struct AHIPrivAudioCtrl *) iounit->AudioCtrl)->ahiac_SubLib;

  si.ahisi_Type    = ioreq->ahir_Type;
  si.ahisi_Address = ioreq->ahir_Std.io_Data;
  si.ahisi_Length  = ioreq->ahir_Std.io_Length;

  // Load the sound
  
  for(sound = 0; sound < MAXSOUNDS; sound++)
  {
    if(iounit->Sounds[sound] == SOUND_FREE)
    {
      iounit->Sounds[sound] = SOUND_IN_USE;
      break;
    }
  }

  if((sound < MAXSOUNDS) &&
     (AHI_LoadSound(sound, AHIST_DYNAMICSAMPLE, &si, iounit->AudioCtrl)
      == AHIE_OK)) {

    GetExtras(ioreq)->Sound = sound;

    ObtainSemaphore(&iounit->ListLock);
  
    if(ioreq->ahir_Link)
    {
      // See if the linked request is playing, silent or waiting...
  
      if(FindNode((struct List *) &iounit->PlayingList,
          (struct Node *) ioreq->ahir_Link))
      {
        delay = TRUE;
      }
      else if(FindNode((struct List *) &iounit->SilentList,
          (struct Node *) ioreq->ahir_Link))
      {
        delay = TRUE;
      }
      else if(FindNode((struct List *) &iounit->WaitingList,
          (struct Node *) ioreq->ahir_Link))
      {
        delay = TRUE;
      }
    }

  // NOTE: ahir_Link changes direction here. When the user set's it, she makes a new
  // request point to an old. We let the old point to the next (that's more natural,
  // anyway...) It the user tries to link more than one request to another, we fail.
  
    if(delay)
    {
      if( ! ioreq->ahir_Link->ahir_Link)
      {
        struct AHIRequest *otherioreq = ioreq->ahir_Link;
      
        channel = GetExtras(ioreq->ahir_Link)->Channel;
        GetExtras(ioreq)->Channel = NOCHANNEL;
  
        otherioreq->ahir_Link = ioreq;
        ioreq->ahir_Link = NULL;
        Enqueue((struct List *) &iounit->WaitingList,(struct Node *) ioreq);
  
        if(channel != NOCHANNEL)
        {
          // Attach the request to the currently playing one
  
          AHIsub_Disable((struct AHIAudioCtrlDrv *) iounit->AudioCtrl);

          // Make SURE the current sound isn't already finished!
          
          if(otherioreq->ahir_Std.io_Command == AHICMD_WRITTEN)
          {
            AHIsub_Enable((struct AHIAudioCtrlDrv *) iounit->AudioCtrl);

            // OOPS! It's finished! Undo...
            Remove((struct Node *) ioreq);
            
            // Start sound as if it wasn't delayed (see below);
            AddWriter(ioreq, iounit, AHIBase);
          }
          else
          {
            iounit->Voices[channel].QueuedRequest = ioreq;
            iounit->Voices[channel].NextOffset  = PLAY;
            iounit->Voices[channel].NextRequest = NULL;
            AHI_Play(iounit->AudioCtrl,
                AHIP_BeginChannel,  channel,
                AHIP_LoopFreq,      ioreq->ahir_Frequency,
                AHIP_LoopVol,       ioreq->ahir_Volume,
                AHIP_LoopPan,       ioreq->ahir_Position,
                AHIP_LoopSound,     GetExtras(ioreq)->Sound,
                AHIP_LoopOffset,    ioreq->ahir_Std.io_Actual,
                AHIP_LoopLength,    ioreq->ahir_Std.io_Length - ioreq->ahir_Std.io_Actual,
                AHIP_EndChannel,    NULL,
                TAG_DONE);
            AHIsub_Enable((struct AHIAudioCtrlDrv *) iounit->AudioCtrl);
          }

        }
      }
      else // She tried to add more than one request to another one
      { 
        ioreq->ahir_Std.io_Error = AHIE_UNKNOWN;
        TermIO(ioreq, AHIBase);
      }
    }
    else // Sound is not delayed
    {
      ioreq->ahir_Link=NULL;
      AddWriter(ioreq, iounit, AHIBase);
    }

    ReleaseSemaphore(&iounit->ListLock);
  }
  else // No free sound found, or sound failed to load
  {
    ioreq->ahir_Std.io_Error = AHIE_UNKNOWN;
    TermIO(ioreq, AHIBase);
  }
}
Exemple #14
0
void DBaseDecal::Destroy ()
{
	Remove ();
	Super::Destroy ();
}
Exemple #15
0
static void DOT_RunRequest(WindoW w, BioseqPtr qbsp, BioseqPtr sbsp, DOTStartDataPtr sdata){
  Char            str1[100]={""}, str2[100]={""};
  SeqLocPtr       slp1=NULL, slp2=NULL;
  SeqAlignPtr     sap = NULL;
  DOTMainDataPtr  mip;
  DOTAlignInfoPtr alp=NULL;
  SCP_ResultPtr    scp=NULL;


  MemSet((Pointer)str1, '\0', sizeof(str1));
  GetTitle (sdata->querystart,  str1,  sizeof(str1));
  if (StringCmp(str1, "All")==0)
     q_start=0; 
  else
    q_start=DOT_GetValue(sdata->querystart);
  MemSet((Pointer)str1, '\0', sizeof(str1));
  GetTitle(sdata->querystop, str1, sizeof(str1));
  if (StringCmp(str1, "All")==0)
    q_stop=qbsp->length-1;
  else
      q_stop=DOT_GetValue(sdata->querystop);
  MemSet((Pointer)str1, '\0', sizeof(str1));
  GetTitle(sdata->subjectstart, str1, sizeof(str1));
  if (StringCmp(str1, "All")==0)
    s_start=0;
  else
    s_start=DOT_GetValue(sdata->subjectstart);
  MemSet((Pointer)str1, '\0', sizeof(str1));
  GetTitle(sdata->subjectstop, str1, sizeof(str1));
  if (StringCmp(str1, "All")==0)
    s_stop=sbsp->length-1;
  else
    s_stop=DOT_GetValue(sdata->subjectstop);
  if (qbsp->length<q_start || sbsp->length<s_start || q_start>q_stop|| s_start>s_stop || s_start<0 || q_start<0)
    {
      ErrPostEx(SEV_FATAL, 1, 0, "Bad sequence offset values");
      return;
    }
  
  if (GetStatus(sdata->reg_blast)){
    if (GetValue(sdata->plusorminus) == 1){
      slp1 = NULL;
      slp2 = NULL;
    }
    else {
      slp1= SeqLocIntNew(q_start, q_stop, 1, qbsp->id);
      if (GetValue(sdata->plusorminus) == 2)
        slp2 = SeqLocIntNew(s_start, s_stop, 1, sbsp->id);
      else
        slp2 = SeqLocIntNew(s_start, s_stop,2, sbsp->id);
    }
  }
  else if (GetStatus(sdata->auto_blast)){
    slp1 = SeqLocIntNew(q_start, q_stop, 1, qbsp->id);
    slp2 = SeqLocIntNew(s_start, s_stop,1, sbsp->id);
  }
  else if (GetStatus(sdata->dot)){
    slp1= SeqLocIntNew(q_start, q_stop, 1, qbsp->id);
    if (GetValue(sdata->plusorminus) == 1)
      slp2 = SeqLocIntNew(s_start, s_stop,1, sbsp->id);
    else
      slp2 = SeqLocIntNew(s_start, s_stop, 2, sbsp->id);
  }
  
  if (GetStatus(sdata->reg_blast)){
    sap = DOT_RunBlast2Seqs(qbsp, sbsp, slp1, slp2, sdata);
    if (sap == NULL){
      Message (MSG_OK, "Blast 2 Seqs -  returned NULL");
      DOT_quitProgram(NULL);
      return;
    }
    DOT_AlignPlotGivenSeqAlign(sap);
  }
  else if (GetStatus(sdata->dot) || GetStatus(sdata->auto_blast)){
    
    word_size=DOT_GetValue(sdata->wordsize);
    tree_limit=DOT_GetValue(sdata->hitsize);
    
    if (GetStatus(sdata->dot)){
      mip=DOT_CreateAndStorebyLoc(slp1, slp2, word_size, tree_limit);
      if (mip == NULL){
        Message (MSG_OK, "Dot Plot analysis returned NULL");
        DOT_quitProgram(NULL);
        return;
      }
      Remove(sdata->hStart);
      Remove(w);
      DOT_MakeMainViewer(mip, alp);
    }
    else if (GetStatus(sdata->auto_blast)){
      scp=SCP_CompareOrderOrganizeBioseqs(qbsp, sbsp, slp1, slp2, "blastn", word_size, tree_limit);
      if (scp == NULL){
        Message (MSG_OK, "Blast 2 Seqs - return NULL");
        DOT_quitProgram(NULL);
        return;
      }
      DOT_AlignPlotGivenScp(scp);
    } 
  } 
}
// Snapshot objects
void backdrop_snapshot(BackdropInfo *info,BOOL unsnapshot,BOOL all,BackdropObject *icon)
{
	BackdropObject *object;
	Lister *lister;
	IPCData *ipc;
	BPTR old,lock;
	short count=0,beep=0;
#ifdef DISTINCT_OK
	BOOL save_env=0;
#endif
	BOOL savepos=0;

	// Lock backdrop list
	lock_listlock(&info->objects,0);

	// Lock lister list
	lock_listlock(&GUI->lister_list,0);

	// Lock group list
	lock_listlock(&GUI->group_list,0);

	// Go through backdrop list
	for (object=(BackdropObject *)info->objects.list.lh_Head;
		object->node.ln_Succ;
		object=(BackdropObject *)object->node.ln_Succ)
	{
		BOOL ok=0;

		// Icon supplied?
		if (icon)
		{
			// Does it match?
			if (object!=icon || !object->icon) continue;
		}

		// Is object selected?
		else
		if ((!object->state && !all) || !object->icon) continue;
		beep=1;

		// Appicon?
		if (object->type==BDO_APP_ICON)
		{
			// Does icon support snapshot itself?
			if (WB_AppIconFlags((struct AppIcon *)object->misc_data)&APPENTF_SNAPSHOT)
			{
				backdrop_appicon_message(object,(unsnapshot)?BAPPF_UNSNAPSHOT:0);
				++count;
			}

			// Otherwise, fake snapshot
			else
			if (*object->name) ok=1;
		}

		// Otherwise, is it ok to snapshot?
		else
		if (object->type!=BDO_BAD_DISK) ok=1;

		// Ok to snapshot?
		if (ok)
		{
			short x,y;

			// UnShapshot?
			if (unsnapshot)
			{
				// Set "no position" position
				x=-1;
				y=-1;
			}

			// Snapshot
			else
			{
				// Drawer?
				if (object->icon->do_DrawerData)
				{
					// Group icon?
					if (object->type==BDO_GROUP)
					{
						GroupData *group;

						// See if group is open
						if ((group=backdrop_find_group(object)))
						{
							// Update window position
							*((struct IBox *)&object->icon->do_DrawerData->dd_NewWindow.LeftEdge)=group->dimensions;
						}
					}

					// Otherwise go through listers
					else
					for (ipc=(IPCData *)GUI->lister_list.list.lh_Head;
						ipc->node.mln_Succ;
						ipc=(IPCData *)ipc->node.mln_Succ)
					{
						// Get lister
						lister=IPCDATA(ipc);

						// Is lister from this icon?
						if (lister->backdrop==object)
						{
							// Update lister
							PositionUpdate(lister,POSUPF_SAVE);
							break;
						}
					}
				}

				// Get position
				x=object->pos.Left;
				y=object->pos.Top;
			}

			// AppIcon?
			if (object->type==BDO_APP_ICON)
			{
				leftout_record *left;

				// Lock position list
				lock_listlock(&GUI->positions,TRUE);

				// Look for entry for icon
				for (left=(leftout_record *)&GUI->positions.list.lh_Head;
					left->node.ln_Succ;
					left=(leftout_record *)left->node.ln_Succ)
				{
					// Leftout?
					if (left->node.ln_Type==PTYPE_APPICON)
					{
						// Match this icon?
						if (strcmp(left->icon_label,object->name)==0)
							break;
					}
				}

				// Didn't find one?
				if (!(left->node.ln_Succ) && !unsnapshot)
				{
					// Create a new entry
					if ((left=AllocMemH(GUI->position_memory,sizeof(leftout_record))))
					{
						// Fill out entry
						stccpy(left->icon_label,object->name,sizeof(left->icon_label));
						left->node.ln_Name=left->name;
						left->node.ln_Type=PTYPE_APPICON;

						// Add to list
						AddTail((struct List *)&GUI->positions,(struct Node *)left);
					}
				}

				// Got one?
				if (left->node.ln_Succ)
				{
					// Unsnapshot?
					if (unsnapshot)
					{
						// Remove entry and free it
						Remove((struct Node *)left);
						FreeMemH(left);
					}

					// Update entry
					else
					{
						ULONG iflags;

						// Adjust for borders?
						if (!((iflags=GetIconFlags(object->icon))&ICONF_BORDER_OFF) &&
							(!(environment->env->desktop_flags&DESKTOPF_NO_BORDERS) || (iflags&ICONF_BORDER_ON)))
						{
							// Shift back by border size
							x-=ICON_BORDER_X;
							y-=ICON_BORDER_Y_TOP;
						}

						// Save position
						left->icon_x=x;
						left->icon_y=y;
						left->flags&=~LEFTOUTF_NO_POSITION;
					}

					// Set flag to save positions
					savepos=1;
				}

				// Can't snapshot for some reason
				else
				if (!unsnapshot) beep=1;

				// Unlock position list
				unlock_listlock(&GUI->positions);
			}

			// Left-out on desktop?
			else
			if (object->type==BDO_LEFT_OUT && !(object->flags&BDOF_DESKTOP_FOLDER) && info->flags&BDIF_MAIN_DESKTOP)
			{
				leftout_record *left;

				// Lock position list
				lock_listlock(&GUI->positions,0);

				// Look for entry for icon
				for (left=(leftout_record *)&GUI->positions.list.lh_Head;
					left->node.ln_Succ;
					left=(leftout_record *)left->node.ln_Succ)
				{
					// Leftout?
					if (left->node.ln_Type==PTYPE_LEFTOUT)
					{
						// Match this icon?
						if (object->misc_data==(ULONG)left) break;
					}
				}

				// Got one?
				if (left->node.ln_Succ)
				{
					// Save position
					left->icon_x=x;
					left->icon_y=y;
					left->flags&=~LEFTOUTF_NO_POSITION;

					// Set flag to save positions
					savepos=1;
				}

				// Must be temporary
				else beep=1;

				// Unlock position list
				unlock_listlock(&GUI->positions);
			}

#ifdef DISTINCT_OK
			// Distinct icon positions?
			else
			if (environment->env->desktop_flags&DESKTOPF_DISTINCT &&
				info->flags&BDIF_MAIN_DESKTOP)
			{
				// Snapshot icon for this environment
				desktop_snapshot_icon(object,x,y);
				save_env=1;
			}
#endif

			// Group icon?
			else
			if (info->flags&BDIF_GROUP)
			{
				// Snapshot in group
				group_snapshot_icon(info,object,x,y);
			}

			// Save to icon
			else
			{
				// Using Workbench positions?
				if (environment->env->display_options&DISPOPTF_ICON_POS)
				{
					// Set position
					object->icon->do_CurrentX=(unsnapshot)?NO_ICON_POSITION:x-WBICONMAGIC_X;
					object->icon->do_CurrentY=(unsnapshot)?NO_ICON_POSITION:y-WBICONMAGIC_Y;

					// Removing Opus positions?
					if (environment->env->display_options&DISPOPTF_REMOPUSPOS)
					{
						// Remove Opus position from icon
						SetIconFlags(object->icon,GetIconFlags(object->icon)&~ICONF_POSITION_OK);
					}
				}

				// Using Opus positions
				else
				{
					// Set "position ok" flag
					SetIconFlags(object->icon,GetIconFlags(object->icon)|ICONF_POSITION_OK);

					// Update icon position
					SetIconPosition(object->icon,x,y);
				}

				// Get icon lock
				if ((lock=backdrop_icon_lock(object)))
				{
					// Change directory
					old=CurrentDir(lock);

					// Save this object out
					if (!(WriteIcon((object->icon->do_Type==WBDISK)?"Disk":object->name,object->icon)))
						beep=1;

					// Success; is this in a lister?
					else
					if (info->lister)
					{
						char name[256];

						// Get icon name
						strcpy(name,(object->icon->do_Type==WBDISK)?"Disk":object->name);
						strcat(name,".info");

						// Reload the file
						rexx_lister_reload_file(info->lister,name);
					}

					// Restore directory
					CurrentDir(old);
					UnLock(lock);
				}
			}

			++count;
		}

		// Icon supplied?
		if (icon) break;
	}

	// Failed to do anything?
	if (!count && beep) DisplayBeep(info->window->WScreen);

	// Unlock group list
	unlock_listlock(&GUI->group_list);

	// Unlock backdrop list
	unlock_listlock(&info->objects);

	// Unlock lister list
	unlock_listlock(&GUI->lister_list);

#ifdef DISTINCT_OK
	// Save environment file?
	if (save_env && environment->env->flags&ENVF_CHANGED)
	{
		// Save environment
		if (environment_save(environment,environment->path,0,0))
			environment->env->flags&=~ENVF_CHANGED;
	}
#endif

	// Save positions?
	if (savepos)
	{
		// Lock list
		lock_listlock(&GUI->positions,0);

		// Save list
		SavePositions(&GUI->positions.list,GUI->position_name);

		// Unlock list
		unlock_listlock(&GUI->positions);
	}

	// If this is a lister, update its datestamp
	if (info->lister) update_buffer_stamp(info->lister);
}
Exemple #17
0
bool C4PlayerList::Remove(int iPlayer, bool fDisconnect, bool fNoCalls)
{
	return Remove(Get(iPlayer), fDisconnect, fNoCalls);
}
void
DocAccessibleParent::Destroy()
{
  // If we are already shutdown that is because our containing tab parent is
  // shutting down in which case we don't need to do anything.
  if (mShutdown) {
    return;
  }

  mShutdown = true;

  MOZ_DIAGNOSTIC_ASSERT(LiveDocs().Contains(mActorID));
  uint32_t childDocCount = mChildDocs.Length();
  for (uint32_t i = 0; i < childDocCount; i++) {
    for (uint32_t j = i + 1; j < childDocCount; j++) {
      MOZ_DIAGNOSTIC_ASSERT(mChildDocs[i] != mChildDocs[j]);
    }
  }

  // XXX This indirection through the hash map of live documents shouldn't be
  // needed, but be paranoid for now.
  int32_t actorID = mActorID;
  for (uint32_t i = childDocCount - 1; i < childDocCount; i--) {
    DocAccessibleParent* thisDoc = LiveDocs().Get(actorID);
    MOZ_ASSERT(thisDoc);
    if (!thisDoc) {
      return;
    }

    thisDoc->ChildDocAt(i)->Destroy();
  }

  for (auto iter = mAccessibles.Iter(); !iter.Done(); iter.Next()) {
    MOZ_ASSERT(iter.Get()->mProxy != this);
    ProxyDestroyed(iter.Get()->mProxy);
    iter.Remove();
  }

  DocAccessibleParent* thisDoc = LiveDocs().Get(actorID);
  MOZ_ASSERT(thisDoc);
  if (!thisDoc) {
    return;
  }

  // The code above should have already completely cleared these, but to be
  // extra safe make sure they are cleared here.
  thisDoc->mAccessibles.Clear();
  thisDoc->mChildDocs.Clear();

  DocManager::NotifyOfRemoteDocShutdown(thisDoc);
  thisDoc = LiveDocs().Get(actorID);
  MOZ_ASSERT(thisDoc);
  if (!thisDoc) {
    return;
  }

  ProxyDestroyed(thisDoc);
  thisDoc = LiveDocs().Get(actorID);
  MOZ_ASSERT(thisDoc);
  if (!thisDoc) {
    return;
  }

  if (DocAccessibleParent* parentDoc = thisDoc->ParentDoc())
    parentDoc->RemoveChildDoc(thisDoc);
  else if (IsTopLevel())
    GetAccService()->RemoteDocShutdown(this);
}
Exemple #19
0
void wxGISMenu::MoveCommandLeft(size_t nIndex)
{
	wxMenuItem *pMenuItem = Remove(FindItemByPosition(nIndex));
	Insert(nIndex - 1, pMenuItem);
	wxGISCommandBar::MoveCommandLeft(nIndex);
}
Exemple #20
0
int ArcApp::OnRun()
{
    wxString progname;
    m_validCmd = false;
    m_help = argc < 2;
    bool ok = false;
    bool dashdash = false;

    if (*argv && **argv)
        progname = wxFileName(*argv).GetName();
    else
        progname = _T("arc");

    // parse the command line
    for (int i = 1; i < argc; ++i) {
        wxString arg = argv[i];

        if (!dashdash) {
            if (arg == _T("--")) {
                dashdash = true;
                continue;
            } else {
                if (arg == _T("--help") || arg == _T("-h") || arg == _T("/?")) {
                    m_help = true;
                    continue;
                } else {
                    if (*arg == _T('-')) {
                        m_errMsg = _T("invalid option '") + arg + _T("'");
                        break;
                    }
                }
            }
        }
        if (m_cmd.empty())
            m_cmd = arg;
        else if (m_archive.empty())
            m_archive = arg;
        else
            m_args.push_back(arg);
    }

    if (m_errMsg.empty() && !m_archive.empty() && !MakeFactory())
        return EXIT_FAILURE;

    m_filter = m_archive.find(_T('.')) == wxString::npos;

    // dispatch the command, and build up help information
    if (IsCmd(_T("add"),    _T("FILES..."),  _T("add files to an archive")))
        ok = Add();
    if (IsCmd(_T("create"), _T("FILES..."),  _T("create an archive")))
        ok = Create();
    if (IsCmd(_T("extract"),_T("[PATTERN]"), _T("extract entries")))
        ok = Extract();
    if (IsCmd(_T("list"),   _T("[PATTERN]"), _T("list contents")))
        ok = List();
    if (IsCmd(_T("remove"), _T("PATTERN"),   _T("delete entries")))
        ok = Remove();
    if (IsCmd(_T("rename"), _T("FROM TO"),   _T("rename an entry")))
        ok = Rename();

    // IsCmd populates m_availCmds, now use it to make a usage string
    wxString usage = _T("Usage: ") + progname +
        _T(" [-h|--help|/?] [COMMAND ARCHIVE [ARGUMENTS...]]\n") +
        _T("Commands:\n") + m_availCmds;

    // display help or error if necessary
    if (m_errMsg.empty())
        if (m_help) {
            std::cout << usage.mb_str() <<
            "Examples:\n"  <<
            "    " << progname.mb_str() << " add test.zip *\n" <<
            "        The archive type is deduced from the file extension.\n" <<
            "    " << progname.mb_str() << " extract zip < test.zip\n" <<
            "        If ARCHIVE has no extension it is taken to be the name\n" << 
            "        of an archive format and " << progname.mb_str() << " acts as a filter.\n";
            ok = true;
        } else if (!m_validCmd) {
            m_errMsg = _T("invalid command '") + m_cmd + _T("'");
        }

    if (!m_errMsg.empty())
        std::cerr << progname.mb_str() << ": " << m_errMsg.mb_str() << "\n"
                  << usage.mb_str();

    return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}