Added options to remove excessive spacing (#577)

* Add option to configure asm.tabs.off
* Add option to configure asm.cmt.col
This commit is contained in:
Adam Zambrzycki 2018-07-17 09:25:17 +02:00 committed by xarkes
parent 1534e78e06
commit db682f6ef9
5 changed files with 71 additions and 4 deletions

View File

@ -824,11 +824,9 @@ void CutterCore::setSettings()
setConfig("scr.interactive", false);
setConfig("hex.pairs", false);
setConfig("asm.cmt.col", 70);
setConfig("asm.xrefs", false);
setConfig("asm.tabs.once", true);
setConfig("asm.tabs.off", 5);
setConfig("asm.flags.middle", 2);
setConfig("anal.hasnext", false);

View File

@ -40,10 +40,16 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
qhelpers::setCheckedWithoutSignals(ui->fcnlinesCheckBox, Config()->getConfigBool("asm.lines.fcn"));
qhelpers::setCheckedWithoutSignals(ui->flgoffCheckBox, Config()->getConfigBool("asm.flags.offset"));
qhelpers::setCheckedWithoutSignals(ui->emuCheckBox, Config()->getConfigBool("asm.emu"));
qhelpers::setCheckedWithoutSignals(ui->cmtrightCheckBox, Config()->getConfigBool("asm.cmt.right"));
qhelpers::setCheckedWithoutSignals(ui->varsumCheckBox, Config()->getConfigBool("asm.var.summary"));
qhelpers::setCheckedWithoutSignals(ui->sizeCheckBox, Config()->getConfigBool("asm.size"));
bool cmtRightEnabled = Config()->getConfigBool("asm.cmt.right");
qhelpers::setCheckedWithoutSignals(ui->cmtrightCheckBox, cmtRightEnabled);
ui->cmtcolSpinBox->blockSignals(true);
ui->cmtcolSpinBox->setValue(Config()->getConfigInt("asm.cmt.col"));
ui->cmtcolSpinBox->blockSignals(false);
ui->cmtcolSpinBox->setEnabled(cmtRightEnabled);
bool bytesEnabled = Config()->getConfigBool("asm.bytes");
qhelpers::setCheckedWithoutSignals(ui->bytesCheckBox, bytesEnabled);
qhelpers::setCheckedWithoutSignals(ui->bytespaceCheckBox, Config()->getConfigBool("asm.bytespace"));
@ -81,6 +87,10 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
ui->asmTabsSpinBox->setValue(Config()->getConfigInt("asm.tabs"));
ui->asmTabsSpinBox->blockSignals(false);
ui->asmTabsOffSpinBox->blockSignals(true);
ui->asmTabsOffSpinBox->setValue(Config()->getConfigInt("asm.tabs.off"));
ui->asmTabsOffSpinBox->blockSignals(false);
qhelpers::setCheckedWithoutSignals(ui->bblineCheckBox, Config()->getConfigBool("asm.bbline"));
bool varsubEnabled = Config()->getConfigBool("asm.varsub");
@ -167,6 +177,13 @@ void AsmOptionsWidget::on_emuCheckBox_toggled(bool checked)
void AsmOptionsWidget::on_cmtrightCheckBox_toggled(bool checked)
{
Config()->setConfig("asm.cmt.right", checked);
ui->cmtcolSpinBox->setEnabled(checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_cmtcolSpinBox_valueChanged(int value)
{
Config()->setConfig("asm.cmt.col", value);
triggerAsmOptionsChanged();
}
@ -254,6 +271,12 @@ void AsmOptionsWidget::on_asmTabsSpinBox_valueChanged(int value)
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_asmTabsOffSpinBox_valueChanged(int value)
{
Config()->setConfig("asm.tabs.off", value);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bblineCheckBox_toggled(bool checked)
{
Config()->setConfig("asm.bbline", checked);

View File

@ -43,6 +43,7 @@ private slots:
void on_flgoffCheckBox_toggled(bool checked);
void on_emuCheckBox_toggled(bool checked);
void on_cmtrightCheckBox_toggled(bool checked);
void on_cmtcolSpinBox_valueChanged(int value);
void on_varsumCheckBox_toggled(bool checked);
void on_bytesCheckBox_toggled(bool checked);
void on_sizeCheckBox_toggled(bool checked);
@ -51,6 +52,7 @@ private slots:
void on_syntaxComboBox_currentIndexChanged(int index);
void on_caseComboBox_currentIndexChanged(int index);
void on_asmTabsSpinBox_valueChanged(int value);
void on_asmTabsOffSpinBox_valueChanged(int value);
void on_nbytesSpinBox_valueChanged(int value);
void on_bblineCheckBox_toggled(bool checked);
void on_varsubCheckBox_toggled(bool checked);

View File

@ -127,6 +127,27 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="asmTabsOffLabel">
<property name="text">
<string>Tabs before assembly (asm.tabs.off):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="asmTabsOffSpinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="bblineCheckBox">
<property name="text">
@ -141,6 +162,27 @@
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="cmtcolLabel">
<property name="text">
<string>Column to align comments (asm.cmt.col):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="cmtcolSpinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">

View File

@ -22,6 +22,7 @@ static const QHash<QString, QVariant> asmOptions = {
{ "asm.flags.offset", false },
{ "asm.emu", false },
{ "asm.cmt.right", true },
{ "asm.cmt.col", 70 },
{ "asm.var.summary", false },
{ "asm.bytes", false },
{ "asm.size", false },
@ -34,7 +35,8 @@ static const QHash<QString, QVariant> asmOptions = {
{ "asm.capitalize", false },
{ "asm.var.sub", true },
{ "asm.var.subonly", true },
{ "asm.tabs", 5 }
{ "asm.tabs", 5 },
{ "asm.tabs.off", 5 }
};