Exemplo n.º 1
0
//------------------------------------------------------------------------------
void MenuEditor::OnSelectionChanged(BMessage* /*msg*/)
{
	if ((fListView->CurrentSelection() < 0) ||
		is_kind_of(CurrentItem(), BSeparatorItem))
	{
		fLabelText->SetText("");
		fLabelText->SetEnabled(false);
		fMsgText->SetText("none");
		fMsgText->SetEnabled(false);
		fShortcutText->SetText("");
		fShortcutText->SetEnabled(false);
		fModifierField->Menu()->ItemAt(0)->SetMarked(false);
		fModifierField->Menu()->ItemAt(1)->SetMarked(false);
		fModifierField->Menu()->ItemAt(2)->SetMarked(false);
		fModifierField->SetEnabled(false);
		fEnabledBox->SetEnabled(false);
		fEnabledBox->SetValue(B_CONTROL_OFF);
		return;
	}
	else
	{
		fLabelText->SetEnabled(true);
		fMsgText->SetEnabled(true);

		fModifierField->Menu()->ItemAt(0)->SetMarked(false);
		fModifierField->Menu()->ItemAt(1)->SetMarked(false);
		fModifierField->Menu()->ItemAt(2)->SetMarked(false);

		fEnabledBox->SetEnabled(true);
		fEnabledBox->SetValue(CurrentItem()->IsEnabled());

		fShortcutText->SetEnabled(CurrentItem()->Submenu() == NULL);
	}
	fLabelText->SetText(CurrentItem()->Label());
	char temp[5];
	BMenuItem *item = CurrentItem();
	if (item->Message() != NULL)
		strncpy(temp, (char *)(new int32(flipcode(item->Message()->what))), 4);
	else
		strcpy(temp, "none");
	temp[4] = 0;
	fMsgText->SetText(temp);

	uint32 mod;
	temp[1] = 0;
	temp[0] = item->Shortcut(&mod);
	fShortcutText->SetText(temp);

	fModifierField->SetEnabled(*temp);
	if (*temp)
	{
		fModifierField->Menu()->ItemAt(0)->SetMarked(mod & B_OPTION_KEY);
		fModifierField->Menu()->ItemAt(1)->SetMarked(mod & B_SHIFT_KEY);
		fModifierField->Menu()->ItemAt(2)->SetMarked(mod & B_CONTROL_KEY);
	}
}
void
ChangeGadgetLabel(struct MyGadget *gad,char *txt)
{
	BControl *xt;
	BAutolock win(gad->pt->Window());
	
	if (xt = (BControl *)gad->pt->ChildAt(0))
	{
		if (is_kind_of(xt,BControl))
		{
			xt->SetLabel(txt);		
		}	
	}
}
Exemplo n.º 3
0
Arquivo: math.c Projeto: hpersh/ool2
void
math_module_fini(void)
{
  unsigned i;

  for (i = 0; i < ARRAY_SIZE(math_init_inst_method_tbl); ++i) {
    obj_t dict = CLASS(*math_init_inst_method_tbl[i].cl)->inst_methods;
    obj_t sel  = *math_init_inst_method_tbl[i].sel;
    obj_t p, q;

    if (p = dict_at(dict, sel)) {
      q = CDR(p);
      if (is_kind_of(q, consts.cl.code_method)
	  && CODE_METHOD(q)->func == math_init_inst_method_tbl[i].func
	  ) {
	dict_del(dict, sel);
      }
    }
  }
}
Exemplo n.º 4
0
void APModuleLoader::DecrunchFile(APAgent_DecrunchFile *decrunchInfo)
{
	int32 i, count;
	AddOnInfo *info;
	ap_result apResult;

	// Wait to read access to the plug-in list
	GetApp()->pluginLock.WaitToRead();

	try
	{
		// Get number of plug-ins
		count = GetApp()->decruncherAgents.CountItems();

		// Call all the plug-ins
		for (i = 0; i < count; i++)
		{
			// Get agent information
			info = GetApp()->decruncherAgents.GetItem(i);

			// Try to decrunch the file
			apResult = info->agent->Run(info->index, APDA_DECRUNCH_FILE, decrunchInfo);
			if (apResult == AP_ERROR)
				break;

			if (apResult == AP_OK)
			{
				// The file is decrunched
				if (decrunchInfo->decrunchedFile != NULL)
				{
					// Copy the filename to the new file instance
					// if it's a memory file
					if (is_kind_of(decrunchInfo->decrunchedFile, PMemFile))
					{
						try
						{
							decrunchInfo->decrunchedFile->SetFilePath(decrunchInfo->file->GetFullPath());
							decrunchInfo->decrunchedFile->SetFileType(decrunchInfo->file->GetFileType());
						}
						catch(...)
						{
							;
						}
					}

					// Now delete the old file handle.
					// This check is made if the file has been
					// decrunched multiple times
					if (decrunchInfo->file != file)
						delete decrunchInfo->file;

					// Use the new file
					decrunchInfo->file           = decrunchInfo->decrunchedFile;
					decrunchInfo->decrunchedFile = NULL;

					// Take all the decruncher agents one more time,
					// so we can handle recursive packed modules
					i = -1;
				}
			}
		}
	}
	catch(...)
	{
		// Unlock plug-in list
		GetApp()->pluginLock.DoneReading();
		throw;
	}

	// Done with the plug-ins
	GetApp()->pluginLock.DoneReading();
}
Exemplo n.º 5
0
bool APModuleLoader::ConvertModule(APAgent_ConvertModule *convInfo)
{
	int32 i, count;
	AddOnInfo *info;
	ap_result apResult;
	PString convKind, convType;
	PFile *convFile = NULL;
	bool converted = false;

	// Wait to read access to the plug-in list
	GetApp()->pluginLock.WaitToRead();

	try
	{
		// Get number of plug-ins
		count = GetApp()->converterAgents.CountItems();

		// Call all the plug-ins
		for (i = 0; i < count; i++)
		{
			// Get agent information
			info = GetApp()->converterAgents.GetItem(i);

			// Try to convert the module
			apResult = info->agent->Run(info->index, APCA_CONVERT_MODULE, convInfo);
			if (apResult == AP_ERROR)
				break;

			if (apResult == AP_OK)
			{
				// The module is converted
				if (convInfo->newModuleFile != NULL)
				{
					// Copy the filename to the new file instance
					// if it's a memory file
					if (is_kind_of(convInfo->newModuleFile, PMemFile))
						convInfo->newModuleFile->SetFilePath(convInfo->moduleFile->GetFullPath());

					// Now delete the old file handle.
					// This check is made if the module has been
					// converted multiple times
					if (convInfo->moduleFile != file)
						delete convInfo->moduleFile;

					// Remember the converter strings
					if (convKind.IsEmpty())
					{
						convKind = convInfo->modKind;
						convType = convInfo->fileType;
					}

					// Use the new file
					convFile                = convInfo->newModuleFile;
					convInfo->moduleFile    = convInfo->newModuleFile;
					convInfo->newModuleFile = NULL;
					converted               = true;
				}
			}
		}
	}
	catch(...)
	{
		// Unlock plug-in list
		GetApp()->pluginLock.DoneReading();
		throw;
	}

	// Done with the plug-ins
	GetApp()->pluginLock.DoneReading();

	// Store the original converter strings back
	convInfo->modKind       = convKind;
	convInfo->fileType      = convType;
	convInfo->newModuleFile = convFile;

	return (converted);
}